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>
This commit is contained in:

committed by
Junio C Hamano

parent
db10199141
commit
35d803bc9a
@ -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 &&
|
||||
|
Reference in New Issue
Block a user