diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-11-16 14:42:14 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-11-16 16:05:29 +0100 |
commit | f20db199541ea35c65edfeed9e5401cab6fe6bac (patch) | |
tree | 0c697e7e98ceb7e48a7776a401e2229a25aa6ee2 /coccinelle | |
parent | tests: run fuzzers four times in a row (#10794) (diff) | |
download | systemd-f20db199541ea35c65edfeed9e5401cab6fe6bac.tar.gz systemd-f20db199541ea35c65edfeed9e5401cab6fe6bac.tar.bz2 systemd-f20db199541ea35c65edfeed9e5401cab6fe6bac.zip |
cocci: simplify some if checks
Diffstat (limited to 'coccinelle')
-rw-r--r-- | coccinelle/redundant-if.cocci | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/coccinelle/redundant-if.cocci b/coccinelle/redundant-if.cocci new file mode 100644 index 000000000..515e36e15 --- /dev/null +++ b/coccinelle/redundant-if.cocci @@ -0,0 +1,54 @@ +@@ +expression r; +@@ +- if (r < 0) +- return r; +- if (r == 0) +- return 0; ++ if (r <= 0) ++ return r; +@@ +expression r; +@@ +- if (r == 0) +- return 0; +- if (r < 0) +- return r; ++ if (r <= 0) ++ return r; +@@ +expression r; +@@ +- if (r < 0) +- return r; +- if (r == 0) +- return r; ++ if (r <= 0) ++ return r; +@@ +expression r; +@@ +- if (r == 0) +- return r; +- if (r < 0) +- return r; ++ if (r <= 0) ++ return r; +@@ +expression r; +@@ +- if (r < 0) +- return r; +- if (r > 0) +- return r; ++ if (r != 0) ++ return r; +@@ +expression r; +@@ +- if (r > 0) +- return r; +- if (r < 0) +- return r; ++ if (r != 0) ++ return r; |