commit.c: rearrange xcalloc arguments
authorBrian Gesiak <modocache@gmail.com>
Mon, 26 May 2014 15:33:45 +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.
reduce_heads() passes the arguments in reverse order, passing the
size of a commit*, followed by the number of commit* 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>
commit.c
index f4793316a21fe5f3ee1932f7e24cf4ab0920b04c..881be3baa3ccc70afab916331588afb9330258ed 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -1031,7 +1031,7 @@ struct commit_list *reduce_heads(struct commit_list *heads)
                p->item->object.flags |= STALE;
                num_head++;
        }
-       array = xcalloc(sizeof(*array), num_head);
+       array = xcalloc(num_head, sizeof(*array));
        for (p = heads, i = 0; p; p = p->next) {
                if (p->item->object.flags & STALE) {
                        array[i++] = p->item;