Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-03-16 03:56:07 +0300
committerJunio C Hamano <gitster@pobox.com>2021-03-16 03:56:07 +0300
commit1c57cc70ec26529a26392539fc888486bb89b7fd (patch)
tree61b05e45176c3d84885f43595a21d8ad05afda28 /contrib/coccinelle
parentca56dadb4b65ccaeab809d80db80a312dc00941a (diff)
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>
Diffstat (limited to 'contrib/coccinelle')
-rw-r--r--contrib/coccinelle/array.cocci2
1 files changed, 1 insertions, 1 deletions
diff --git a/contrib/coccinelle/array.cocci b/contrib/coccinelle/array.cocci
index 9a17d2a121..9a4f00cb1b 100644
--- a/contrib/coccinelle/array.cocci
+++ b/contrib/coccinelle/array.cocci
@@ -92,7 +92,7 @@ expression n;
@@
type T;
T *ptr;
-expression n;
+expression n != 1;
@@
- ptr = xcalloc(n, \( sizeof(*ptr) \| sizeof(T) \) )
+ CALLOC_ARRAY(ptr, n)