[Cocci] [PATCH] coccinelle: use exists to improve efficiency

Julia Lawall julia.lawall at lip6.fr
Sun Nov 12 16:02:18 CET 2017


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.

Signed-off-by: Julia Lawall <julia.lawall at lip6.fr>

---

diff --git a/scripts/coccinelle/iterators/list_entry_update.cocci b/scripts/coccinelle/iterators/list_entry_update.cocci
index 873f444..be6f9f1 100644
--- a/scripts/coccinelle/iterators/list_entry_update.cocci
+++ b/scripts/coccinelle/iterators/list_entry_update.cocci
@@ -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;


More information about the Cocci mailing list