summaryrefslogtreecommitdiff
path: root/coccinelle
diff options
context:
space:
mode:
authorDaniel Mack <github@zonque.org>2015-09-10 13:46:14 +0200
committerDaniel Mack <github@zonque.org>2015-09-10 13:46:14 +0200
commitf33be3119806f96898dda6ade492fbdcdf8f79b8 (patch)
tree3c470fb770c5a19f848df0487f01af89b0aa6bea /coccinelle
parent89921f6ed085d77225204e160ce2cee99ed0c6fa (diff)
parent525d3cc746a037e8cc6b2e0ebaaf76a51856fa6b (diff)
Merge pull request #1226 from poettering/coccinelle-fixes3
Third round of Coccinelle fixes
Diffstat (limited to 'coccinelle')
-rw-r--r--coccinelle/hashmap_free.cocci54
-rw-r--r--coccinelle/strv_free.cocci27
2 files changed, 81 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);
diff --git a/coccinelle/strv_free.cocci b/coccinelle/strv_free.cocci
new file mode 100644
index 0000000000..0ad56f772f
--- /dev/null
+++ b/coccinelle/strv_free.cocci
@@ -0,0 +1,27 @@
+@@
+expression p;
+@@
+- strv_free(p);
+- p = NULL;
++ p = strv_free(p);
+@@
+expression p;
+@@
+- if (p)
+- strv_free(p);
+- p = NULL;
++ p = strv_free(p);
+@@
+expression p;
+@@
+- if (p) {
+- strv_free(p);
+- p = NULL;
+- }
++ p = strv_free(p);
+@@
+expression p;
+@@
+- if (p)
+- strv_free(p);
++ strv_free(p);