From: Junio C Hamano <gitster@pobox.com>
To: "AreaZR via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, "Jeff Hostetler [ ]" <git@jeffhostetler.com>,
"Ævar Arnfjörð Bjarmason [ ]" <avarab@gmail.com>,
"Bagas Sanjaya [ ]" <bagasdotme@gmail.com>,
AreaZR <gfunni234@gmail.com>,
"Seija Kijin" <doremylover123@gmail.com>
Subject: Re: [PATCH v10] git: use calloc instead of malloc + memset where possible
Date: Wed, 18 Dec 2024 07:39:42 -0800 [thread overview]
Message-ID: <xmqqr065t2yp.fsf@gitster.g> (raw)
In-Reply-To: <pull.1390.v10.git.git.1734485187081.gitgitgadget@gmail.com> (AreaZR via GitGitGadget's message of "Wed, 18 Dec 2024 01:26:26 +0000")
"AreaZR via GitGitGadget" <gitgitgadget@gmail.com> writes:
> From: Seija Kijin <doremylover123@gmail.com>
>
> Avoid calling malloc + memset by calling calloc.
>
> Signed-off-by: Seija <doremylover123@gmail.com>
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).
next prev parent reply other threads:[~2024-12-18 15:39 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-05 14:48 [PATCH] maintenance: use xcalloc instead of xmalloc where possible Rose via GitGitGadget
2022-12-05 15:01 ` Jeff Hostetler
2022-12-05 15:33 ` [PATCH v2] " Rose via GitGitGadget
2022-12-05 16:01 ` [PATCH v3] " Rose via GitGitGadget
2022-12-05 16:12 ` [PATCH v4] maintenance: use calloc instead of malloc " Rose via GitGitGadget
2022-12-06 5:03 ` Junio C Hamano
2022-12-06 17:38 ` [PATCH v5] revision: " Rose via GitGitGadget
2022-12-06 19:44 ` Ævar Arnfjörð Bjarmason
2022-12-06 19:53 ` [PATCH v6] " Rose via GitGitGadget
2022-12-07 8:44 ` Bagas Sanjaya
2024-12-18 0:30 ` [PATCH v7] " AreaZR via GitGitGadget
2024-12-18 0:48 ` [PATCH v8] git: " AreaZR via GitGitGadget
2024-12-18 0:58 ` [PATCH v9] " AreaZR via GitGitGadget
2024-12-18 1:26 ` [PATCH v10] git: use calloc instead of malloc + memset " AreaZR via GitGitGadget
2024-12-18 15:39 ` Junio C Hamano [this message]
2024-12-18 16:48 ` [PATCH v11] " AreaZR via GitGitGadget
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqr065t2yp.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=avarab@gmail.com \
--cc=bagasdotme@gmail.com \
--cc=doremylover123@gmail.com \
--cc=gfunni234@gmail.com \
--cc=git@jeffhostetler.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).