[tor-commits] [tor/master] Add coccinelle script to remove pointless callocs
nickm at torproject.org
nickm at torproject.org
Tue Sep 16 15:11:54 UTC 2014
commit 1bb10353ff30626dae0540de7422e90b30bd68a6
Author: Nick Mathewson <nickm at torproject.org>
Date: Tue Sep 16 11:11:17 2014 -0400
Add coccinelle script to remove pointless callocs
---
scripts/coccinelle/uncalloc.cocci | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/scripts/coccinelle/uncalloc.cocci b/scripts/coccinelle/uncalloc.cocci
new file mode 100644
index 0000000..bf3f741
--- /dev/null
+++ b/scripts/coccinelle/uncalloc.cocci
@@ -0,0 +1,13 @@
+
+@@
+expression a;
+@@
+- tor_calloc(1, a)
++ tor_malloc_zero(a)
+
+@@
+expression a;
+@@
+- tor_calloc(a, 1)
++ tor_malloc_zero(a)
+
More information about the tor-commits
mailing list