summaryrefslogtreecommitdiffstats
path: root/coccinelle/empty-to-null.cocci
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-12-07 12:13:00 +0100
committerLennart Poettering <lennart@poettering.net>2017-12-07 12:13:00 +0100
commita8ea93a5e2a5d6cc2d448a42c265bac2408e0b21 (patch)
tree293aa89e43cb8816321d494c6768c865d0079c8d /coccinelle/empty-to-null.cocci
parentcoccinelle: improve run-coccinelle.sh to take list of scripts to run (diff)
downloadsystemd-a8ea93a5e2a5d6cc2d448a42c265bac2408e0b21.tar.xz
systemd-a8ea93a5e2a5d6cc2d448a42c265bac2408e0b21.zip
core: use empty_to_null() where we can
Diffstat (limited to 'coccinelle/empty-to-null.cocci')
-rw-r--r--coccinelle/empty-to-null.cocci5
1 files changed, 5 insertions, 0 deletions
diff --git a/coccinelle/empty-to-null.cocci b/coccinelle/empty-to-null.cocci
new file mode 100644
index 0000000000..fbc75b9c34
--- /dev/null
+++ b/coccinelle/empty-to-null.cocci
@@ -0,0 +1,5 @@
+@@
+expression s;
+@@
+- isempty(s) ? NULL : s
++ empty_to_null(s)