From: Brian Gesiak Date: Mon, 26 May 2014 15:33:45 +0000 (+0900) Subject: commit.c: rearrange xcalloc arguments X-Git-Tag: v2.0.3~14^2~9 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/c4a7b0092bbe39a6b05ddd65a6b3e45565203367 commit.c: rearrange xcalloc arguments 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 Signed-off-by: Junio C Hamano --- diff --git a/commit.c b/commit.c index f4793316a2..881be3baa3 100644 --- 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;