Imported Upstream version 2.18.3
[platform/upstream/git.git] / pack-revindex.c
index 6bc7c94..bb521cf 100644 (file)
@@ -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);
        }
 
        /*
@@ -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;
                }