builtin/ls-remote.c: rearrange xcalloc arguments
authorBrian Gesiak <modocache@gmail.com>
Mon, 26 May 2014 15:33:43 +0000 (00:33 +0900)
committerJunio C Hamano <gitster@pobox.com>
Tue, 27 May 2014 21:00:43 +0000 (14:00 -0700)
xcalloc() takes two arguments: the number of elements and their size.
cmd_ls_remote() passes the arguments in reverse order, passing the
size of a char*, followed by the number of char* to be allocated.

Rearrange them so they are in the correct order.

Signed-off-by: Brian Gesiak <modocache@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/ls-remote.c
index 3e9eefb0915a4496ead9ddbf3836a4455351dba0..b2a4b92992748ab52fc6fd3f31041dd88dca54f8 100644 (file)
@@ -92,7 +92,7 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
 
        if (argv[i]) {
                int j;
-               pattern = xcalloc(sizeof(const char *), argc - i + 1);
+               pattern = xcalloc(argc - i + 1, sizeof(const char *));
                for (j = i; j < argc; j++) {
                        int len = strlen(argv[j]);
                        char *p = xmalloc(len + 3);