From: Lennart Poettering Date: Sat, 23 Dec 2017 07:47:55 +0000 (+0100) Subject: coccinelle: beef up isempty() checks (#7729) X-Git-Tag: v237~187 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7e985c69832b261a60fc00cc84d7a47a31fcb008;p=platform%2Fupstream%2Fsystemd.git 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. --- diff --git a/coccinelle/isempty.cocci b/coccinelle/isempty.cocci index 1374ee4..d8d5275 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)