diff options
Diffstat (limited to 'pack-revindex.c')
-rw-r--r-- | pack-revindex.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/pack-revindex.c b/pack-revindex.c index 96d51c3467..bb521cf7fb 100644 --- a/pack-revindex.c +++ b/pack-revindex.c @@ -1,5 +1,6 @@ #include "cache.h" #include "pack-revindex.h" +#include "object-store.h" /* * Pack index for existing packs give us easy access to the offsets into @@ -59,7 +60,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 +97,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); } /* @@ -107,7 +105,7 @@ static void sort_revindex(struct revindex_entry *entries, unsigned n, off_t max) * we have to move it back from the temporary storage. */ if (from != entries) - memcpy(entries, tmp, n * sizeof(*entries)); + COPY_ARRAY(entries, tmp, n); free(tmp); free(pos); @@ -137,10 +135,8 @@ static void create_pack_revindex(struct packed_git *p) if (!(off & 0x80000000)) { p->revindex[i].offset = off; } else { - p->revindex[i].offset = - ((uint64_t)ntohl(*off_64++)) << 32; - p->revindex[i].offset |= - ntohl(*off_64++); + p->revindex[i].offset = get_be64(off_64); + off_64 += 2; } p->revindex[i].nr = i; } |