Release coccinelle-0.1
[bpt/coccinelle.git] / demos / janitorings / list_for_each.cocci
CommitLineData
34e49164
C
1@@
2iterator list_for_each;
3statement S;
4expression head;
5struct 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;
14statement S;
15expression head;
16struct 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) {