summaryrefslogtreecommitdiff
path: root/coccinelle/hashmap_free.cocci
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-09-09 23:12:07 +0200
committerLennart Poettering <lennart@poettering.net>2015-09-09 23:12:07 +0200
commit525d3cc746a037e8cc6b2e0ebaaf76a51856fa6b (patch)
treec96ffcfb5a7bf46fdbbd4ea6bf801bc3b3cf7acd /coccinelle/hashmap_free.cocci
parent6796073e330f49923c5134652ee085e29fc88002 (diff)
tree-wide: take benefit of the fact that hashmap_free() returns NULL
And set_free() too. Another Coccinelle patch.
Diffstat (limited to 'coccinelle/hashmap_free.cocci')
-rw-r--r--coccinelle/hashmap_free.cocci54
1 files changed, 54 insertions, 0 deletions
diff --git a/coccinelle/hashmap_free.cocci b/coccinelle/hashmap_free.cocci
new file mode 100644
index 0000000000..86b9542488
--- /dev/null
+++ b/coccinelle/hashmap_free.cocci
@@ -0,0 +1,54 @@
+@@
+expression p;
+@@
+- set_free(p);
+- p = NULL;
++ p = set_free(p);
+@@
+expression p;
+@@
+- if (p)
+- set_free(p);
+- p = NULL;
++ p = set_free(p);
+@@
+expression p;
+@@
+- if (p) {
+- set_free(p);
+- p = NULL;
+- }
++ p = set_free(p);
+@@
+expression p;
+@@
+- if (p)
+- set_free(p);
++ set_free(p);
+@@
+expression p;
+@@
+- hashmap_free(p);
+- p = NULL;
++ p = hashmap_free(p);
+@@
+expression p;
+@@
+- if (p)
+- hashmap_free(p);
+- p = NULL;
++ p = hashmap_free(p);
+@@
+expression p;
+@@
+- if (p) {
+- hashmap_free(p);
+- p = NULL;
+- }
++ p = hashmap_free(p);
+@@
+expression p;
+@@
+- if (p)
+- hashmap_free(p);
++ hashmap_free(p);