diff options
Diffstat (limited to 'scripts/coccinelle/iterators/fen.cocci')
-rw-r--r-- | scripts/coccinelle/iterators/fen.cocci | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/scripts/coccinelle/iterators/fen.cocci b/scripts/coccinelle/iterators/fen.cocci new file mode 100644 index 000000000000..77bc108c3f59 --- /dev/null +++ b/scripts/coccinelle/iterators/fen.cocci | |||
@@ -0,0 +1,64 @@ | |||
1 | /// These iterators only exit normally when the loop cursor is NULL, so there | ||
2 | /// is no point to call of_node_put on the final value. | ||
3 | /// | ||
4 | // Confidence: High | ||
5 | // Copyright: (C) 2010 Nicolas Palix, DIKU. GPLv2. | ||
6 | // Copyright: (C) 2010 Julia Lawall, DIKU. GPLv2. | ||
7 | // Copyright: (C) 2010 Gilles Muller, INRIA/LiP6. GPLv2. | ||
8 | // URL: http://coccinelle.lip6.fr/ | ||
9 | // Comments: | ||
10 | // Options: -no_includes -include_headers | ||
11 | |||
12 | virtual patch | ||
13 | |||
14 | @@ | ||
15 | iterator name for_each_node_by_name; | ||
16 | expression np,E; | ||
17 | identifier l; | ||
18 | @@ | ||
19 | |||
20 | for_each_node_by_name(np,...) { | ||
21 | ... when != break; | ||
22 | when != goto l; | ||
23 | } | ||
24 | ... when != np = E | ||
25 | - of_node_put(np); | ||
26 | |||
27 | @@ | ||
28 | iterator name for_each_node_by_type; | ||
29 | expression np,E; | ||
30 | identifier l; | ||
31 | @@ | ||
32 | |||
33 | for_each_node_by_type(np,...) { | ||
34 | ... when != break; | ||
35 | when != goto l; | ||
36 | } | ||
37 | ... when != np = E | ||
38 | - of_node_put(np); | ||
39 | |||
40 | @@ | ||
41 | iterator name for_each_compatible_node; | ||
42 | expression np,E; | ||
43 | identifier l; | ||
44 | @@ | ||
45 | |||
46 | for_each_compatible_node(np,...) { | ||
47 | ... when != break; | ||
48 | when != goto l; | ||
49 | } | ||
50 | ... when != np = E | ||
51 | - of_node_put(np); | ||
52 | |||
53 | @@ | ||
54 | iterator name for_each_matching_node; | ||
55 | expression np,E; | ||
56 | identifier l; | ||
57 | @@ | ||
58 | |||
59 | for_each_matching_node(np,...) { | ||
60 | ... when != break; | ||
61 | when != goto l; | ||
62 | } | ||
63 | ... when != np = E | ||
64 | - of_node_put(np); | ||