summaryrefslogtreecommitdiff
path: root/coccinelle
diff options
context:
space:
mode:
Diffstat (limited to 'coccinelle')
-rw-r--r--coccinelle/empty-to-root.cocci11
1 files changed, 11 insertions, 0 deletions
diff --git a/coccinelle/empty-to-root.cocci b/coccinelle/empty-to-root.cocci
new file mode 100644
index 0000000000..45627c9801
--- /dev/null
+++ b/coccinelle/empty-to-root.cocci
@@ -0,0 +1,11 @@
+@@
+expression s;
+@@
+- if (empty_or_root(s))
+- s = "/";
++ s = empty_to_root(s);
+@@
+expression s;
+@@
+- (empty_or_root(s) ? "/" : s)
++ empty_to_root(s)