]> git.ipfire.org Git - thirdparty/systemd.git/blob - coccinelle/in_set.cocci
coccinelle: limit the # of expressions in in_set/not_in_set
[thirdparty/systemd.git] / coccinelle / in_set.cocci
1 /* Limit the number of expressions to 6 for performance reasons */
2 @@
3 expression e;
4 /* Exclude JsonVariant * from the transformation, as it can't work with the
5 * current version of the IN_SET macro */
6 typedef JsonVariant;
7 type T != JsonVariant*;
8 constant T n0, n1, n2, n3, n4, n5;
9 @@
10 (
11 - e == n0 || e == n1 || e == n2 || e == n3 || e == n4 || e == n5
12 + IN_SET(e, n0, n1, n2, n3, n4, n5)
13 |
14 - e == n0 || e == n1 || e == n2 || e == n3 || e == n4
15 + IN_SET(e, n0, n1, n2, n3, n4)
16 |
17 - e == n0 || e == n1 || e == n2 || e == n3
18 + IN_SET(e, n0, n1, n2, n3)
19 |
20 - e == n0 || e == n1 || e == n2
21 + IN_SET(e, n0, n1, n2)
22 |
23 - e == n0 || e == n1
24 + IN_SET(e, n0, n1)
25 )