diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-06-28 14:55:39 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-06-28 14:55:39 -0700 |
commit | ca400f824b88ec9dc3b7df8b36413c0adf9248ee (patch) | |
tree | 0da315e544f734755c717c04852b2c44ac3345d3 | |
parent | f8bb4631fb7c97dd9f035a89404fa6beab5867df (diff) | |
download | git-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.cocci | 10 |
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); |