mirror of
https://github.com/git/git
synced 2024-08-25 02:35:46 +00: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;
|
p->item->object.flags |= STALE;
|
||||||
num_head++;
|
num_head++;
|
||||||
}
|
}
|
||||||
array = xcalloc(sizeof(*array), num_head);
|
array = xcalloc(num_head, sizeof(*array));
|
||||||
for (p = heads, i = 0; p; p = p->next) {
|
for (p = heads, i = 0; p; p = p->next) {
|
||||||
if (p->item->object.flags & STALE) {
|
if (p->item->object.flags & STALE) {
|
||||||
array[i++] = p->item;
|
array[i++] = p->item;
|
||||||
|
|
Loading…
Reference in a new issue