Sync with 2.9.3
[gitweb.git] / show-index.c
index 4c0ac138aff7b5add73e17fc9c3c4e409fd918e2..1ead41e21131fcb3facc71c8e1d96bf5b65dbe8d 100644 (file)
@@ -2,9 +2,9 @@
 #include "pack.h"
 
 static const char show_index_usage[] =
-"git show-index < <packed archive index>";
+"git show-index";
 
-int main(int argc, char **argv)
+int cmd_main(int argc, const char **argv)
 {
        int i;
        unsigned nr;
@@ -48,7 +48,8 @@ int main(int argc, char **argv)
                        unsigned char sha1[20];
                        uint32_t crc;
                        uint32_t off;
-               } *entries = malloc(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);