diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-09-09 23:12:07 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-09-09 23:12:07 +0200 |
commit | 525d3cc746a037e8cc6b2e0ebaaf76a51856fa6b (patch) | |
tree | c96ffcfb5a7bf46fdbbd4ea6bf801bc3b3cf7acd /coccinelle/hashmap_free.cocci | |
parent | tree-wide: make use of the fact that strv_free() returns NULL (diff) | |
download | systemd-525d3cc746a037e8cc6b2e0ebaaf76a51856fa6b.tar.xz systemd-525d3cc746a037e8cc6b2e0ebaaf76a51856fa6b.zip |
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.cocci | 54 |
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); |