diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-01-10 17:11:19 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-01-10 17:11:19 +0100 |
commit | ad5d4b1703da43acfa69503c7101cb754066914c (patch) | |
tree | 388056ecd6fee91df32f328f0f6197b767fe9815 /coccinelle | |
parent | Merge pull request #7836 from jkloetzke/shutdown-no-coredumps (diff) | |
download | systemd-ad5d4b1703da43acfa69503c7101cb754066914c.tar.xz systemd-ad5d4b1703da43acfa69503c7101cb754066914c.zip |
cocci: use strempty() at more places
This shortens the code by a few lines.
Diffstat (limited to 'coccinelle')
-rw-r--r-- | coccinelle/strempty.cocci | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/coccinelle/strempty.cocci b/coccinelle/strempty.cocci index e3bd0a1f56..13ceb338f1 100644 --- a/coccinelle/strempty.cocci +++ b/coccinelle/strempty.cocci @@ -8,3 +8,41 @@ expression s; @@ - s ? s : "" + strempty(s) +@@ +expression s; +@@ +- if (!s) +- s = ""; ++ s = strempty(s); +@@ +expression s; +@@ +- s ?: "(null)" ++ strnull(s) +@@ +expression s; +@@ +- s ? s : "(null)" ++ strnull(s) +@@ +expression s; +@@ +- if (!s) +- s = "(null)"; ++ s = strnull(s); +@@ +expression s; +@@ +- s ?: "n/a" ++ strna(s) +@@ +expression s; +@@ +- s ? s : "n/a" ++ strna(s) +@@ +expression s; +@@ +- if (!s) +- s = "n/a"; ++ s = strna(s); |