aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/coccinelle
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-03-19 15:25:39 -0700
committerJunio C Hamano <gitster@pobox.com>2021-03-19 15:25:39 -0700
commitbfcc6e2a68b95ee71fc606a2e3917af78f1130f9 (patch)
tree30a225e537754d8b2579304d9872b0374be18c73 /contrib/coccinelle
parentaf107029b1b10f56b7e8b35ea605eab54f4efbe2 (diff)
parent241b5d3ebeea21b70a74fdc8c74e73f7ed829cb1 (diff)
downloadgit-bfcc6e2a68b95ee71fc606a2e3917af78f1130f9.tar.gz
Merge branch 'rs/xcalloc-takes-nelem-first'
Code cleanup. * rs/xcalloc-takes-nelem-first: fix xcalloc() argument order
Diffstat (limited to 'contrib/coccinelle')
-rw-r--r--contrib/coccinelle/xcalloc.cocci10
1 files changed, 10 insertions, 0 deletions
diff --git a/contrib/coccinelle/xcalloc.cocci b/contrib/coccinelle/xcalloc.cocci
new file mode 100644
index 0000000000..c291011607
--- /dev/null
+++ b/contrib/coccinelle/xcalloc.cocci
@@ -0,0 +1,10 @@
+@@
+type T;
+T *ptr;
+expression n;
+@@
+ xcalloc(
++ n,
+ \( sizeof(T) \| sizeof(*ptr) \)
+- , n
+ )