[tor-commits] [tor/master] Refactor the calloc semantic patch.

nickm at torproject.org nickm at torproject.org
Sun Nov 2 17:09:19 UTC 2014


commit a746081f385e20422a314f57ac21ad95b7fd0b09
Author: Mansour Moufid <mansourmoufid at gmail.com>
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)
-
- at 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@





More information about the tor-commits mailing list