summaryrefslogtreecommitdiffstats
path: root/coccinelle
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2019-07-16 12:08:47 +0200
committerLennart Poettering <lennart@poettering.net>2019-07-16 12:40:22 +0200
commit9228fef0d6ba495b6c1bc697b88d8728421b5394 (patch)
tree8cb197f51e283d2dd7462a9948da1a6620409f7f /coccinelle
parentcryptsetup: no need to zero-initialize zero-initialized structures (diff)
downloadsystemd-9228fef0d6ba495b6c1bc697b88d8728421b5394.tar.xz
systemd-9228fef0d6ba495b6c1bc697b88d8728421b5394.zip
tree-wide: use empty-to-root a bit more
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)