aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/coccinelle/iterators
diff options
context:
space:
mode:
authorNicolas Palix <npalix@diku.dk>2010-08-24 11:39:01 -0400
committerMichal Marek <mmarek@suse.cz>2010-08-31 05:37:53 -0400
commit4045159253a49a56d117148d67bc86a72762a0d3 (patch)
tree55c9a56609b0354e86a5e23d38f20dcf82ce2754 /scripts/coccinelle/iterators
parent54c056280e0dfcd39b33c4ed75116ce98697511c (diff)
Coccinelle: Add iterators/fen.cocci
for_each_node iterators only exit normally when the loop cursor is NULL, so there is no point to call of_node_put on the final value. Signed-off-by: Nicolas Palix <npalix@diku.dk> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Michal Marek <mmarek@suse.cz>
Diffstat (limited to 'scripts/coccinelle/iterators')
-rw-r--r--scripts/coccinelle/iterators/fen.cocci64
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
12virtual patch
13
14@@
15iterator name for_each_node_by_name;
16expression np,E;
17identifier l;
18@@
19
20for_each_node_by_name(np,...) {
21 ... when != break;
22 when != goto l;
23}
24... when != np = E
25- of_node_put(np);
26
27@@
28iterator name for_each_node_by_type;
29expression np,E;
30identifier l;
31@@
32
33for_each_node_by_type(np,...) {
34 ... when != break;
35 when != goto l;
36}
37... when != np = E
38- of_node_put(np);
39
40@@
41iterator name for_each_compatible_node;
42expression np,E;
43identifier l;
44@@
45
46for_each_compatible_node(np,...) {
47 ... when != break;
48 when != goto l;
49}
50... when != np = E
51- of_node_put(np);
52
53@@
54iterator name for_each_matching_node;
55expression np,E;
56identifier l;
57@@
58
59for_each_matching_node(np,...) {
60 ... when != break;
61 when != goto l;
62}
63... when != np = E
64- of_node_put(np);