mirror of
https://github.com/git/git.git
synced 2024-11-24 02:17:02 +08:00
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 <modocache@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
380694544d
commit
c4a7b0092b
2
commit.c
2
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;
|
||||
|
Loading…
Reference in New Issue
Block a user