summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-06-28 14:55:39 -0700
committerJunio C Hamano <gitster@pobox.com>2017-06-28 14:55:39 -0700
commitca400f824b88ec9dc3b7df8b36413c0adf9248ee (patch)
tree0da315e544f734755c717c04852b2c44ac3345d3
parentf8bb4631fb7c97dd9f035a89404fa6beab5867df (diff)
downloadgit-ab/free-and-null.tar.gz
Revert "coccinelle: add a rule to make "expression" code use FREE_AND_NULL()"ab/free-and-null
This reverts commit f8bb4631fb7c97dd9f035a89404fa6beab5867df; it is reported that older Coccinelle (1.0.4 from Debian) still needs "type T" rule, not just the "expression E" one.
-rw-r--r--contrib/coccinelle/free.cocci10
1 files changed, 9 insertions, 1 deletions
diff --git a/contrib/coccinelle/free.cocci b/contrib/coccinelle/free.cocci
index 4490069df9..f2d97e755b 100644
--- a/contrib/coccinelle/free.cocci
+++ b/contrib/coccinelle/free.cocci
@@ -11,8 +11,16 @@ expression E;
free(E);
@@
+type T;
+T *ptr;
+@@
+- free(ptr);
+- ptr = NULL;
++ FREE_AND_NULL(ptr);
+
+@@
expression E;
@@
- free(E);
-+ FREE_AND_NULL(E);
- E = NULL;
++ FREE_AND_NULL(E);