From 35d803bc9a0d21c36b1381f6e42455beeb73b715 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Sat, 28 Jan 2017 22:40:58 +0100 Subject: 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 Signed-off-by: Junio C Hamano --- strbuf.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'strbuf.h') diff --git a/strbuf.h b/strbuf.h index 2262b1268..cf1b5409e 100644 --- a/strbuf.h +++ b/strbuf.h @@ -109,9 +109,7 @@ extern void strbuf_attach(struct strbuf *, void *, size_t, size_t); */ static inline void strbuf_swap(struct strbuf *a, struct strbuf *b) { - struct strbuf tmp = *a; - *a = *b; - *b = tmp; + SWAP(*a, *b); } -- cgit v1.2.1