summaryrefslogtreecommitdiff
path: root/builtin/diff-tree.c
diff options
context:
space:
mode:
authorLibravatar René Scharfe <l.s.r@web.de>2017-01-28 22:40:58 +0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-01-30 14:17:00 -0800
commit35d803bc9a0d21c36b1381f6e42455beeb73b715 (patch)
tree045fa1fa1b75d7477bcd6e49f9ea2a75a9211732 /builtin/diff-tree.c
parentapply: use SWAP macro (diff)
downloadtgif-35d803bc9a0d21c36b1381f6e42455beeb73b715.tar.xz
use SWAP macro
Apply the semantic patch swap.cocci to convert hand-rolled swaps to use the macro SWAP. The resulting code is shorter and easier to read, the object code is effectively unchanged. The patch for object.c had to be hand-edited in order to preserve the comment before the change; Coccinelle tried to eat it for some reason. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/diff-tree.c')
-rw-r--r--builtin/diff-tree.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/builtin/diff-tree.c b/builtin/diff-tree.c
index 806dd7a885..8ce00480cd 100644
--- a/builtin/diff-tree.c
+++ b/builtin/diff-tree.c
@@ -147,9 +147,7 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix)
tree1 = opt->pending.objects[0].item;
tree2 = opt->pending.objects[1].item;
if (tree2->flags & UNINTERESTING) {
- struct object *tmp = tree2;
- tree2 = tree1;
- tree1 = tmp;
+ SWAP(tree2, tree1);
}
diff_tree_sha1(tree1->oid.hash,
tree2->oid.hash,