mmap(win32): avoid copy-on-write when it is unnecessary
[gitweb.git] / show-index.c
index d9e4903fed24f5916962f8d315eb680f9b4013ff..acf8d5445ad96aacf6d2c3ccc2d77a3815291228 100644 (file)
@@ -50,7 +50,8 @@ int main(int argc, char **argv)
                        unsigned char sha1[20];
                        uint32_t crc;
                        uint32_t off;
-               } *entries = xmalloc(nr * sizeof(entries[0]));
+               } *entries;
+               ALLOC_ARRAY(entries, nr);
                for (i = 0; i < nr; i++)
                        if (fread(entries[i].sha1, 20, 1, stdin) != 1)
                                die("unable to read sha1 %u/%u", i, nr);