cocci: allow xcalloc(1, size)
Allocating a pre-cleared single element is quite common and it is misleading to use CALLOC_ARRAY(); these allocations that would be affected without this change are not allocating an array. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Mar 15, 2021 at 17:56 UTC
1c57cc70ec26529a26392539fc888486bb89b7fd
1 file changed
+1
-1
contrib/coccinelle/array.cocci
+1
-1
@@ -92,7 +92,7 @@ expression n;
92
@@
93
type T;
94
T *ptr;
95
-expression n;
95
+expression n != 1;
96
@@
97
- ptr = xcalloc(n, \( sizeof(*ptr) \| sizeof(T) \) )
98
+ CALLOC_ARRAY(ptr, n)