]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Refactor the calloc semantic patch.
authorMansour Moufid <mansourmoufid@gmail.com>
Sun, 19 Oct 2014 16:18:31 +0000 (12:18 -0400)
committerNick Mathewson <nickm@torproject.org>
Sun, 2 Nov 2014 16:54:42 +0000 (11:54 -0500)
This does not change its effects.

scripts/coccinelle/calloc.cocci

index 8a295eb4fdb6c9e11478382a3499f0e23f87819e..f7d7ec0dc3834ede45be2cc47edac8c2e8553fb2 100644 (file)
@@ -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@