summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-02-15 20:54:19 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-02-15 20:54:19 (GMT)
commitcbf1860d73b782e7924e63361df485b31225a26a (patch)
treea86ce71a399fb8153be1552f08e51c58b2c5b5cf /builtin
parent2f4e87d7777a0bcffa8a7cc3cc52e1e8b2c352ff (diff)
parent9e2edd66dda418dad751d5eb2e5921e05e57cd30 (diff)
downloadgit-cbf1860d73b782e7924e63361df485b31225a26a.zip
git-cbf1860d73b782e7924e63361df485b31225a26a.tar.gz
git-cbf1860d73b782e7924e63361df485b31225a26a.tar.bz2
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 'builtin')
-rw-r--r--builtin/diff-tree.c4
-rw-r--r--builtin/diff.c9
2 files changed, 4 insertions, 9 deletions
diff --git a/builtin/diff-tree.c b/builtin/diff-tree.c
index 806dd7a..8ce0048 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,
diff --git a/builtin/diff.c b/builtin/diff.c
index 7f91f6d..3d64b85 100644
--- a/builtin/diff.c
+++ b/builtin/diff.c
@@ -45,12 +45,9 @@ static void stuff_change(struct diff_options *opt,
return;
if (DIFF_OPT_TST(opt, REVERSE_DIFF)) {
- unsigned tmp;
- const unsigned char *tmp_u;
- const char *tmp_c;
- tmp = old_mode; old_mode = new_mode; new_mode = tmp;
- tmp_u = old_sha1; old_sha1 = new_sha1; new_sha1 = tmp_u;
- tmp_c = old_name; old_name = new_name; new_name = tmp_c;
+ SWAP(old_mode, new_mode);
+ SWAP(old_sha1, new_sha1);
+ SWAP(old_name, new_name);
}
if (opt->prefix &&