summaryrefslogtreecommitdiff
path: root/pack-revindex.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2017-01-28 21:40:58 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-01-30 22:17:00 (GMT)
commit35d803bc9a0d21c36b1381f6e42455beeb73b715 (patch)
tree045fa1fa1b75d7477bcd6e49f9ea2a75a9211732 /pack-revindex.c
parentdb101991414f4e14b3763b4843dddcca6b31b40b (diff)
downloadgit-35d803bc9a0d21c36b1381f6e42455beeb73b715.zip
git-35d803bc9a0d21c36b1381f6e42455beeb73b715.tar.gz
git-35d803bc9a0d21c36b1381f6e42455beeb73b715.tar.bz2
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 'pack-revindex.c')
-rw-r--r--pack-revindex.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/pack-revindex.c b/pack-revindex.c
index 6bc7c94..1b7ebd8 100644
--- a/pack-revindex.c
+++ b/pack-revindex.c
@@ -59,7 +59,6 @@ static void sort_revindex(struct revindex_entry *entries, unsigned n, off_t max)
* be a no-op, as everybody lands in the same zero-th bucket.
*/
for (bits = 0; max >> bits; bits += DIGIT_SIZE) {
- struct revindex_entry *swap;
unsigned i;
memset(pos, 0, BUCKETS * sizeof(*pos));
@@ -97,9 +96,7 @@ static void sort_revindex(struct revindex_entry *entries, unsigned n, off_t max)
* Now "to" contains the most sorted list, so we swap "from" and
* "to" for the next iteration.
*/
- swap = from;
- from = to;
- to = swap;
+ SWAP(from, to);
}
/*