summaryrefslogtreecommitdiff
path: root/scripts/coccinelle
diff options
context:
space:
mode:
authorMansour Moufid <mansourmoufid@gmail.com>2014-10-19 12:18:31 -0400
committerNick Mathewson <nickm@torproject.org>2014-11-02 11:54:42 -0500
commita746081f385e20422a314f57ac21ad95b7fd0b09 (patch)
tree5f3099cfedced53f532688e38d3ec617f4af0fa4 /scripts/coccinelle
parent3206dbdce1d055e30d84f9f5dd433c733fee3d8a (diff)
downloadtor-a746081f385e20422a314f57ac21ad95b7fd0b09.tar.gz
tor-a746081f385e20422a314f57ac21ad95b7fd0b09.zip
Refactor the calloc semantic patch.
This does not change its effects.
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@