Debian Codegraph @

demos/janitorings/list_for_each.cocci

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