[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Refactor the calloc semantic patch.
commit a746081f385e20422a314f57ac21ad95b7fd0b09
Author: Mansour Moufid <mansourmoufid@xxxxxxxxx>
Date: Sun Oct 19 12:18:31 2014 -0400
Refactor the calloc semantic patch.
This does not change its effects.
---
scripts/coccinelle/calloc.cocci | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/scripts/coccinelle/calloc.cocci b/scripts/coccinelle/calloc.cocci
index 8a295eb..f7d7ec0 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@
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits