diff options
author | Lennart Poettering <lennart@poettering.net> | 2017-11-29 12:40:22 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2017-11-29 12:41:08 +0100 |
commit | 7b943bb7e3e2fad3481c7191edbfaeef0680b196 (patch) | |
tree | cdbc6c8016fef04137c80128eb92f47a057915be /coccinelle | |
parent | bus-unit-util: properly serialize EnvironmentFile= empty assignment (diff) | |
download | systemd-7b943bb7e3e2fad3481c7191edbfaeef0680b196.tar.xz systemd-7b943bb7e3e2fad3481c7191edbfaeef0680b196.zip |
tree-wide: use strv_isempty() instead of strv_length() == 0
It's a lot faster in many cases, since it's O(1) rather than O(n).
Diffstat (limited to 'coccinelle')
-rw-r--r-- | coccinelle/isempty.cocci | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/coccinelle/isempty.cocci b/coccinelle/isempty.cocci new file mode 100644 index 0000000000..1374ee40d7 --- /dev/null +++ b/coccinelle/isempty.cocci @@ -0,0 +1,15 @@ +@@ +expression s; +@@ +- strv_length(s) == 0 ++ strv_isempty(s) +@@ +expression s; +@@ +- strlen(s) == 0 ++ isempty(s) +@@ +expression s; +@@ +- strlen_ptr(s) == 0 ++ isempty(s) |