summaryrefslogtreecommitdiff
path: root/scripts/coccinelle
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-09-16 11:11:17 -0400
committerNick Mathewson <nickm@torproject.org>2014-09-16 11:11:17 -0400
commit1bb10353ff30626dae0540de7422e90b30bd68a6 (patch)
treecc1572e0d24425e972b4404eb8ab397675210db0 /scripts/coccinelle
parentef9a0d204838768055194bd47acdb0074c2f13cb (diff)
downloadtor-1bb10353ff30626dae0540de7422e90b30bd68a6.tar.gz
tor-1bb10353ff30626dae0540de7422e90b30bd68a6.zip
Add coccinelle script to remove pointless callocs
Diffstat (limited to 'scripts/coccinelle')
-rw-r--r--scripts/coccinelle/uncalloc.cocci13
1 files changed, 13 insertions, 0 deletions
diff --git a/scripts/coccinelle/uncalloc.cocci b/scripts/coccinelle/uncalloc.cocci
new file mode 100644
index 0000000000..bf3f74165a
--- /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)
+