aboutsummaryrefslogtreecommitdiff
path: root/scripts/coccinelle
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/coccinelle')
-rw-r--r--scripts/coccinelle/calloc.cocci9
1 files changed, 2 insertions, 7 deletions
diff --git a/scripts/coccinelle/calloc.cocci b/scripts/coccinelle/calloc.cocci
index 8a295eb4fd..f7d7ec0dc3 100644
--- a/scripts/coccinelle/calloc.cocci
+++ b/scripts/coccinelle/calloc.cocci
@@ -1,15 +1,10 @@
// Use calloc or realloc as appropriate instead of multiply-and-alloc
@malloc_to_calloc@
-expression a,b;
-@@
-- tor_malloc(a * b)
-+ tor_calloc(a, b)
-
-@malloc_zero_to_calloc@
+identifier f =~ "(tor_malloc|tor_malloc_zero)";
expression a, b;
@@
-- tor_malloc_zero(a * b)
+- f(a * b)
+ tor_calloc(a, b)
@realloc_to_reallocarray@