Skip to content

Commit

Permalink
commit.c: rearrange xcalloc arguments
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Brian Gesiak authored and Junio C Hamano committed May 27, 2014
1 parent 3806945 commit c4a7b00
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c4a7b00

Please sign in to comment.