update-index: fix cache entry leak in add_one_file()
[git.git] / contrib / coccinelle / swap.cocci
bloba0934d1fdaf07e9748fb2055e4a47b029bcf8948
1 @ swap_with_declaration @
2 type T;
3 identifier tmp;
4 T a, b;
5 @@
6 - T tmp = a;
7 + T tmp;
8 + tmp = a;
9   a = b;
10   b = tmp;
12 @ swap @
13 type T;
14 T tmp, a, b;
16 - tmp = a;
17 - a = b;
18 - b = tmp;
19 + SWAP(a, b);
21 @ extends swap @
22 identifier unused;
24   {
25   ...
26 - T unused;
27   ... when != unused
28   }