]> git.ipfire.org Git - thirdparty/git.git/commitdiff
promisor-remote: fix xcalloc() argument order
authorSZEDER Gábor <szeder.dev@gmail.com>
Tue, 23 Aug 2022 09:57:33 +0000 (11:57 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 24 Aug 2022 15:50:39 +0000 (08:50 -0700)
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>
promisor-remote.c

index db2ebdc66ef2fe465456e39c4d33c6e5f6bd36de..1a2983c7016fca50f1d0161580f83000de06e529 100644 (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);