Browse Source

coccinelle: mini_lock: improve performance

Replace <+... ...+> by ... when any.  <+... ...+> is slow, and in some
obscure cases involving backward jumps it doesn't force the unlock to
actually come after the end of the if.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Julia Lawall 7 years ago
parent
commit
32d0572a75
1 changed files with 4 additions and 2 deletions
  1. 4 2
      scripts/coccinelle/locks/mini_lock.cocci

+ 4 - 2
scripts/coccinelle/locks/mini_lock.cocci

@@ -67,12 +67,14 @@ identifier lock,unlock;
 @@
 @@
 
 
 *lock(E1@p,...);
 *lock(E1@p,...);
-<+... when != E1
+... when != E1
+    when any
 if (...) {
 if (...) {
   ... when != E1
   ... when != E1
 *  return@r ...;
 *  return@r ...;
 }
 }
-...+>
+... when != E1
+    when any
 *unlock@up(E1,...);
 *unlock@up(E1,...);
 
 
 @script:python depends on org@
 @script:python depends on org@