diff options
author | René Scharfe <l.s.r@web.de> | 2017-01-28 22:40:58 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-01-30 14:17:00 -0800 |
commit | 35d803bc9a0d21c36b1381f6e42455beeb73b715 (patch) | |
tree | 045fa1fa1b75d7477bcd6e49f9ea2a75a9211732 /diff.c | |
parent | apply: use SWAP macro (diff) | |
download | tgif-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 'diff.c')
-rw-r--r-- | diff.c | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -5118,13 +5118,11 @@ void diff_change(struct diff_options *options, if (DIFF_OPT_TST(options, REVERSE_DIFF)) { unsigned tmp; - const unsigned char *tmp_c; - tmp = old_mode; old_mode = new_mode; new_mode = tmp; - tmp_c = old_sha1; old_sha1 = new_sha1; new_sha1 = tmp_c; + SWAP(old_mode, new_mode); + SWAP(old_sha1, new_sha1); tmp = old_sha1_valid; old_sha1_valid = new_sha1_valid; new_sha1_valid = tmp; - tmp = old_dirty_submodule; old_dirty_submodule = new_dirty_submodule; - new_dirty_submodule = tmp; + SWAP(old_dirty_submodule, new_dirty_submodule); } if (options->prefix && |