From 9a1c502865ee1bb8238d78d864dd31c78519347c Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Mon, 24 Feb 2025 12:15:01 +0100 Subject: [PATCH] miext: replace xallocarray() by calloc() Only key difference that calloc(), in contrast to rellocarray(), is zero-initializing. The overhead is hard to measure on today's machines, and it's safer programming practise to always allocate zero-initialized, so one can't forget to do it explicitly. Cocci rule: @@ expression COUNT; expression LEN; @@ - xallocarray(COUNT,LEN) + calloc(COUNT,LEN) Signed-off-by: Enrico Weigelt, metux IT consult --- miext/damage/damage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/miext/damage/damage.c b/miext/damage/damage.c index 499055f11..56f24d756 100644 --- a/miext/damage/damage.c +++ b/miext/damage/damage.c @@ -1318,7 +1318,7 @@ damageText(DrawablePtr pDrawable, if (!checkGCDamage(pDrawable, pGC)) return; - charinfo = xallocarray(count, sizeof(CharInfoPtr)); + charinfo = calloc(count, sizeof(CharInfoPtr)); if (!charinfo) return;