Skip to contentSkip to conversation

coccinelle: use exists to improve efficiency

PATCH In review Julia Lawall 2 participants 2 messages Nov 12, 2017 – Nov 15, 2017 Coccinelle/Semantic Patches (SmPL)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 coccinelle: use exists to improve efficiency

This just needs to find any reassignment of the loop iterator, and doesn't need such a thing on all execution paths, so use exists on the first rule.

---

scripts/coccinelle/iterators/list_entry_update.cocci +1 -1
index 873f444..be6f9f1 100644
@@ -15,7 +15,7 @@ virtual context
 virtual org
 virtual report
 
- at r@
+ at r exists@
 iterator name list_for_each_entry;
 expression x,E;
 position p1,p2;
#1 lore raw

2017-11-13 0:02 GMT+09:00 Julia Lawall <[email protected]>:

Quoted 12 lines

This just needs to find any reassignment of the loop iterator, and doesn't need such a thing on all execution paths, so use exists on the first rule.

---

scripts/coccinelle/iterators/list_entry_update.cocci +0 -0
index 873f444..be6f9f1 100644

scripts/coccinelle/iterators/list_entry_update.cocci virtual context · line 21

Quoted 8 lines
scripts/coccinelle/iterators/list_entry_update.cocci +1 -1
@@ -15,7 +15,7 @@ virtual context
 virtual org
 virtual report
 
- at r@
+ at r exists@
 iterator name list_for_each_entry;
 expression x,E;
 position p1,p2;

Applied to linux-kbuild/misc. Thanks!

Signature · 2 lines
Best Regards
Masahiro Yamada