aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-12-23 08:47:55 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-12-23 08:47:55 +0100
commit7e985c69832b261a60fc00cc84d7a47a31fcb008 (patch)
treee910c12d2c75a5b6540c8aeb45bd87a8a739a9e0 /coccinelle
parentman: fix example config to conform the content of the man page (diff)
downloadsystemd-7e985c69832b261a60fc00cc84d7a47a31fcb008.tar.gz
systemd-7e985c69832b261a60fc00cc84d7a47a31fcb008.tar.bz2
systemd-7e985c69832b261a60fc00cc84d7a47a31fcb008.zip
coccinelle: beef up isempty() checks (#7729)
With these additions, coccinelle finds everything fixed by the first commit in PR #7695. In order not to needlessly conflict with that PR this PR won't include those fixes, but only the coccinelle changes to detect them automatically in the future.
Diffstat (limited to 'coccinelle')
-rw-r--r--coccinelle/isempty.cocci45
1 files changed, 45 insertions, 0 deletions
diff --git a/coccinelle/isempty.cocci b/coccinelle/isempty.cocci
index 1374ee40d..d8d527588 100644
--- a/coccinelle/isempty.cocci
+++ b/coccinelle/isempty.cocci
@@ -6,10 +6,55 @@ expression s;
@@
expression s;
@@
+- strv_length(s) <= 0
++ strv_isempty(s)
+@@
+expression s;
+@@
+- strv_length(s) > 0
++ !strv_isempty(s)
+@@
+expression s;
+@@
+- strv_length(s) != 0
++ !strv_isempty(s)
+@@
+expression s;
+@@
- strlen(s) == 0
+ isempty(s)
@@
expression s;
@@
+- strlen(s) <= 0
++ isempty(s)
+@@
+expression s;
+@@
+- strlen(s) > 0
++ !isempty(s)
+@@
+expression s;
+@@
+- strlen(s) != 0
++ !isempty(s)
+@@
+expression s;
+@@
- strlen_ptr(s) == 0
+ isempty(s)
+@@
+expression s;
+@@
+- strlen_ptr(s) <= 0
++ isempty(s)
+@@
+expression s;
+@@
+- strlen_ptr(s) > 0
++ !isempty(s)
+@@
+expression s;
+@@
+- strlen_ptr(s) != 0
++ !isempty(s)