summaryrefslogtreecommitdiff
path: root/coccinelle
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
parent6796073e330f49923c5134652ee085e29fc88002 (diff)
downloadsystemd-525d3cc746a037e8cc6b2e0ebaaf76a51856fa6b.tar.gz
tree-wide: take benefit of the fact that hashmap_free() returns NULL
And set_free() too. Another Coccinelle patch.
Diffstat (limited to 'coccinelle')
-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);