summaryrefslogtreecommitdiff
path: root/coccinelle
diff options
context:
space:
mode:
authorAndreas Rammhold <andreas@rammhold.de>2017-09-29 00:37:23 +0200
committerAndreas Rammhold <andreas@rammhold.de>2017-10-02 13:09:54 +0200
commit3742095b27f8df4b195d530b52d15bc5fea70bf1 (patch)
tree3fc7c3503845b733f1d58366436c0bb672d3613a /coccinelle
parent01a65d4180446661732d90d23a24ab692d279295 (diff)
tree-wide: use IN_SET where possible
In addition to the changes from #6933 this handles cases that could be matched with the included cocci file.
Diffstat (limited to 'coccinelle')
-rw-r--r--coccinelle/in_set.cocci35
1 files changed, 35 insertions, 0 deletions
diff --git a/coccinelle/in_set.cocci b/coccinelle/in_set.cocci
new file mode 100644
index 0000000000..f5ddd3d334
--- /dev/null
+++ b/coccinelle/in_set.cocci
@@ -0,0 +1,35 @@
+@@
+expression e;
+identifier n1, n2, n3, n4, n5, n6;
+statement s;
+@@
+- e == n1 || e == n2 || e == n3 || e == n4 || e == n5 || e == n6
++ IN_SET(e, n1, n2, n3, n4, n5, n6)
+@@
+expression e;
+identifier n1, n2, n3, n4, n5;
+statement s;
+@@
+- e == n1 || e == n2 || e == n3 || e == n4 || e == n5
++ IN_SET(e, n1, n2, n3, n4, n5)
+@@
+expression e;
+identifier n1, n2, n3, n4;
+statement s;
+@@
+- e == n1 || e == n2 || e == n3 || e == n4
++ IN_SET(e, n1, n2, n3, n4)
+@@
+expression e;
+identifier n1, n2, n3;
+statement s;
+@@
+- e == n1 || e == n2 || e == n3
++ IN_SET(e, n1, n2, n3)
+@@
+expression e;
+identifier n, p;
+statement s;
+@@
+- e == n || e == p
++ IN_SET(e, n, p)