t/lib-httpd: pass through GIT_CONFIG_NOSYSTEM env
[gitweb.git] / pack-revindex.c
index e542ea7703a740916f8d2cac9176674782d37f61..f6a3613bebe4ae8d398ab3b0ada22ba81b1339ee 100644 (file)
@@ -83,10 +83,14 @@ static void sort_revindex(struct revindex_entry *entries, unsigned n, off_t max)
         * keep track of them with alias pointers, always sorting from "from"
         * to "to".
         */
-       struct revindex_entry *tmp = xmalloc(n * sizeof(*tmp));
-       struct revindex_entry *from = entries, *to = tmp;
+       struct revindex_entry *tmp, *from, *to;
        int bits;
-       unsigned *pos = xmalloc(BUCKETS * sizeof(*pos));
+       unsigned *pos;
+
+       ALLOC_ARRAY(pos, BUCKETS);
+       ALLOC_ARRAY(tmp, n);
+       from = entries;
+       to = tmp;
 
        /*
         * If (max >> bits) is zero, then we know that the radix digit we are
@@ -161,7 +165,7 @@ static void create_pack_revindex(struct pack_revindex *rix)
        unsigned i;
        const char *index = p->index_data;
 
-       rix->revindex = xmalloc(sizeof(*rix->revindex) * (num_ent + 1));
+       ALLOC_ARRAY(rix->revindex, num_ent + 1);
        index += 4 * 256;
 
        if (p->index_version > 1) {