Subject: Re: [PATCH v10] git: use calloc instead of malloc + memset where possible

From: Junio C Hamano <[email-masked]>
Date: Wed, 18 Dec 2024 07:39:42 -0800

"AreaZR via GitGitGadget" <[email-masked]> writes:

> From: Seija Kijin <[email-masked]>
>
> Avoid calling malloc + memset by calling calloc.
>
> Signed-off-by: Seija <[email-masked]>

Name mismatch.

>  remote.c    |  4 ++--
>  submodule.c | 10 +++++-----
>  2 files changed, 7 insertions(+), 7 deletions(-)

I somehow hoped to see that this shrinks the line count, as you are
essentially replacing two calls (malloc + memset) with one, but that
is not what is happening, which is a bit disapointing.

But this is a strict improvement, I guess.  The reader needs to be
familiar with the CALLOC_ARRAY() macro to understand it, which may
make the code less newbie-friendly (as opposed to malloc+memset any
reasonably competent C programmer would understand without any prior
knowledge of the conventions used by this project).