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:
René Scharfe
2017-01-28 22:40:58 +01:00
committed by Junio C Hamano
parent db10199141
commit 35d803bc9a
11 changed files with 15 additions and 39 deletions

View File

@ -269,8 +269,7 @@ int parse_range_arg(const char *arg, nth_line_fn_t nth_line_cb,
return -1;
if (*begin && *end && *end < *begin) {
long tmp;
tmp = *end; *end = *begin; *begin = tmp;
SWAP(*end, *begin);
}
return 0;