1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-11 11:16:08 +02:00

promisor-remote: fix xcalloc() argument order

Pass the number of elements first and their size second, as expected
by xcalloc().

Patch generated with:

  make SPATCH_FLAGS=--recursive-includes contrib/coccinelle/xcalloc.cocci.patch

Our default SPATCH_FLAGS ('--all-includes') doesn't catch this
transformation by default, unless used in combination with a large-ish
SPATCH_BATCH_SIZE which happens to put 'promisor-remote.c' with a file
that includes 'repository.h' directly in the same batch.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
SZEDER Gábor 2022-08-23 11:57:33 +02:00 committed by Junio C Hamano
parent 359da658ae
commit c4bbd9bb8f

View File

@ -146,7 +146,7 @@ static void promisor_remote_init(struct repository *r)
if (r->promisor_remote_config)
return;
config = r->promisor_remote_config =
xcalloc(sizeof(*r->promisor_remote_config), 1);
xcalloc(1, sizeof(*r->promisor_remote_config));
config->promisors_tail = &config->promisors;
repo_config(r, promisor_remote_config, config);