Merge branch 'rs/swap'
Code clean-up. * rs/swap: graph: use SWAP macro diff: use SWAP macro use SWAP macro apply: use SWAP macro add SWAP macro
This commit is contained in:
28
contrib/coccinelle/swap.cocci
Normal file
28
contrib/coccinelle/swap.cocci
Normal file
@ -0,0 +1,28 @@
|
||||
@ swap_with_declaration @
|
||||
type T;
|
||||
identifier tmp;
|
||||
T a, b;
|
||||
@@
|
||||
- T tmp = a;
|
||||
+ T tmp;
|
||||
+ tmp = a;
|
||||
a = b;
|
||||
b = tmp;
|
||||
|
||||
@ swap @
|
||||
type T;
|
||||
T tmp, a, b;
|
||||
@@
|
||||
- tmp = a;
|
||||
- a = b;
|
||||
- b = tmp;
|
||||
+ SWAP(a, b);
|
||||
|
||||
@ extends swap @
|
||||
identifier unused;
|
||||
@@
|
||||
{
|
||||
...
|
||||
- T unused;
|
||||
... when != unused
|
||||
}
|
Reference in New Issue
Block a user