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