a850fa3510a238d59c048c0c252636e1ad9780cc
[bpt/coccinelle.git] / demos / janitorings / list_for_each.cocci
1 @@
2 iterator list_for_each;
3 statement S;
4 expression head;
5 struct list_head *pos;
6 @@
7 - for (pos = head.next; pos != &head; pos = pos->next)
8 - S
9 //+ list_for_each(pos, &head)
10
11
12 @@
13 //iterator list_for_each;
14 statement S;
15 expression head;
16 struct list_head *pos;
17 @@
18 - for (pos = head->next; pos != head; pos = pos->next)
19 - S
20 //+ list_for_each(pos, head)
21
22
23
24 // list_add, list_del
25 // list_move
26 // list_del_init
27 // list_add_tail
28
29 // { ... when !=
30 // list_del() \| xxx->next = E \| list_add() \| f(...,xxx,...)
31 // }
32
33
34 // le cas single statement
35
36
37
38 // in 0c5719c43d34073f6b4b0a2dd99f5317a5f63abd
39 //
40 //- struct list_head *walk = &pdev->bus_list;
41 //+ struct list_head *walk;
42 //
43 //- for (walk = walk->next; walk != &pdev->bus_list; walk = walk->next) {