t3504: use test_commit
[gitweb.git] / pack-revindex.c
index 96d51c3467b9ef864f62962aa3567247338d2c3a..1b7ebd8d7eefbcc646867db3e52536b4aac42208 100644 (file)
@@ -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);
        }
 
        /*
@@ -107,7 +104,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);