fix xcalloc() argument order
Pass the number of elements first and ther size second, as expected by xcalloc(). Provide a semantic patch, which was actually used to generate the rest of this patch. The semantic patch would generate flip-flop diffs if both arguments are sizeofs. We don't have such a case, and it's hard to imagine the usefulness of such an allocation. If it ever occurs then we could deal with it by duplicating the rule in the semantic patch to make it cancel itself out, or we could change the code to use CALLOC_ARRAY. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
59ec22464f
commit
241b5d3ebe
@ -768,7 +768,8 @@ static int if_atom_handler(struct atom_value *atomv, struct ref_formatting_state
|
||||
struct strbuf *unused_err)
|
||||
{
|
||||
struct ref_formatting_stack *new_stack;
|
||||
struct if_then_else *if_then_else = xcalloc(sizeof(struct if_then_else), 1);
|
||||
struct if_then_else *if_then_else = xcalloc(1,
|
||||
sizeof(struct if_then_else));
|
||||
|
||||
if_then_else->str = atomv->atom->u.if_then_else.str;
|
||||
if_then_else->cmp_status = atomv->atom->u.if_then_else.cmp_status;
|
||||
@ -2242,7 +2243,7 @@ static void reach_filter(struct ref_array *array,
|
||||
if (!check_reachable)
|
||||
return;
|
||||
|
||||
to_clear = xcalloc(sizeof(struct commit *), array->nr);
|
||||
to_clear = xcalloc(array->nr, sizeof(struct commit *));
|
||||
|
||||
repo_init_revisions(the_repository, &revs, NULL);
|
||||
|
||||
|
Reference in New Issue
Block a user