[Cocci] iterator and single line statement
Corentin Chary
corentin.chary at gmail.com
Mon Apr 20 13:19:29 CEST 2009
Hi,
I'm trying to do a patch to replace list_for_each_entry with
ulist_for_each_entry (don't ask why, it's ugly).
Here is my patch:
@@
iterator name list_for_each_entry;
iterator name ulist_for_each_entry;
statement S;
type T;
T *a;
expression b, c;
@@
- list_for_each_entry(a, b, c)
+ ulist_for_each_entry(a, b, c, T)
S
@@
iterator name list_for_each_entry_safe;
iterator name ulist_for_each_entry_safe;
statement S;
type T;
T *a;
expression b, c;
@@
- list_for_each_entry_safe(a, b, c)
+ ulist_for_each_entry_safe(a, b, c, T)
S
With a single line statement it produce :
spin_lock(&c->buds_lock);
for (i = 0; i < c->jhead_cnt; i++)
- list_for_each_entry(bud, &c->jheads[i].buds_list, list)
+ {ulist_for_each_entry(bud, &c->jheads[i].buds_list,
list, struct ubifs_bud)
bud_bytes += c->leb_size - bud->start;
+ }
Is it a bug in coccinelle, or my patch is not ok ?
Thanks
--
Corentin Chary
http://xf.iksaif.net
More information about the Cocci
mailing list