aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-02-15 12:54:19 -0800
committerJunio C Hamano <gitster@pobox.com>2017-02-15 12:54:19 -0800
commitcbf1860d73b782e7924e63361df485b31225a26a (patch)
treea86ce71a399fb8153be1552f08e51c58b2c5b5cf /contrib
parent2f4e87d7777a0bcffa8a7cc3cc52e1e8b2c352ff (diff)
parent9e2edd66dda418dad751d5eb2e5921e05e57cd30 (diff)
downloadgit-cbf1860d73b782e7924e63361df485b31225a26a.tar.gz
git-cbf1860d73b782e7924e63361df485b31225a26a.tar.xz
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
Diffstat (limited to 'contrib')
-rw-r--r--contrib/coccinelle/swap.cocci28
1 files changed, 28 insertions, 0 deletions
diff --git a/contrib/coccinelle/swap.cocci b/contrib/coccinelle/swap.cocci
new file mode 100644
index 000000000..a0934d1fd
--- /dev/null
+++ b/contrib/coccinelle/swap.cocci
@@ -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
+ }