summaryrefslogtreecommitdiff
path: root/coccinelle
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-10-16 15:57:40 +0200
committerLennart Poettering <lennart@poettering.net>2018-10-16 17:45:53 +0200
commit6dd91b368298e3b3b264a5f2cb5647b2c5cb692b (patch)
tree5efce35acb0653f9f476fe74c5ba36af1baf64f6 /coccinelle
parentf7eed93f151cde4578f4a0363934520896807b84 (diff)
downloadsystemd-6dd91b368298e3b3b264a5f2cb5647b2c5cb692b.tar.gz
tree-wide: CMP()ify all the things
Let's employ coccinelle to fix everything up automatically for us.
Diffstat (limited to 'coccinelle')
-rw-r--r--coccinelle/cmp.cocci28
1 files changed, 28 insertions, 0 deletions
diff --git a/coccinelle/cmp.cocci b/coccinelle/cmp.cocci
new file mode 100644
index 0000000000..a34cbe5bf6
--- /dev/null
+++ b/coccinelle/cmp.cocci
@@ -0,0 +1,28 @@
+@@
+expression x, y;
+@@
+- if (x < y)
+- return -1;
+- if (x > y)
+- return 1;
+- return 0;
++ return CMP(x, y);
+@@
+expression x, y;
+@@
+- if (x < y)
+- return -1;
+- else if (x > y)
+- return 1;
+- return 0;
++ return CMP(x, y);
+@@
+expression x, y;
+@@
+- if (x < y)
+- return -1;
+- else if (x > y)
+- return 1;
+- else
+- return 0;
++ return CMP(x, y);