From: Jeff King <peff@peff.net>
To: Taylor Blau <me@ttaylorr.com>
Cc: git@vger.kernel.org, "Jan Pokorný" <poki@fnusa.cz>
Subject: Re: [PATCH 1/4] repack: convert "names" util bitfield to array
Date: Fri, 21 Oct 2022 19:29:34 -0400 [thread overview]
Message-ID: <Y1MrXoobkVKngYL1@coredump.intra.peff.net> (raw)
In-Reply-To: <Y1Mm9zTX3XwN3IWu@nand.local>
On Fri, Oct 21, 2022 at 07:10:47PM -0400, Taylor Blau wrote:
> > + struct generated_pack_data *data = xcalloc(1, sizeof(*data));
>
> I'm nitpicking, but we could replace this with;
>
> struct generated_pack_data *data;
>
> CALLOC_ARRAY(data, 1);
>
> so that we don't have to rely on calling sizeof(*data). But
> sizeof(*data) will always give us the right answer anyway, even if the
> name of data's type changed, so what you have is fine, too.
Yeah, I actually considered writing it that way, but it felt a bit silly
to use _ARRAY for something which is clearly meant to be a single item.
Grepping for "CALLOC_ARRAY([^)]*, 1)" does seem to turn up quite a few
hits, though, so maybe it is just me.
We could also introduce:
#define CALLOC(x) CALLOC_ARRAY((x), 1)
but even if we think that is a good idea, it should not be in this
series.
It looks I may re-roll for the fname_old stuff in the other part of the
thread, so I'll take your suggestion.
-Peff
next prev parent reply other threads:[~2022-10-21 23:29 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-21 21:41 [PATCH 0/4] repack tempfile-cleanup signal deadlock Jeff King
2022-10-21 21:42 ` [PATCH 1/4] repack: convert "names" util bitfield to array Jeff King
2022-10-21 22:19 ` Junio C Hamano
2022-10-21 23:10 ` Taylor Blau
2022-10-21 23:29 ` Jeff King [this message]
2022-10-21 23:35 ` Junio C Hamano
2022-10-21 23:43 ` Jeff King
2022-10-21 23:51 ` Junio C Hamano
2022-10-22 0:12 ` Jeff King
2022-10-21 21:43 ` [PATCH 2/4] repack: populate extension bits incrementally Jeff King
2022-10-21 23:20 ` Taylor Blau
2022-10-21 23:34 ` Jeff King
2022-10-21 23:41 ` Taylor Blau
2022-10-21 23:42 ` Jeff King
2022-10-21 21:46 ` [PATCH 3/4] repack: use tempfiles for signal cleanup Jeff King
2022-10-21 22:30 ` Junio C Hamano
2022-10-21 23:24 ` Jeff King
2022-10-21 23:45 ` Taylor Blau
2022-10-22 0:12 ` Jeff King
2022-10-22 0:11 ` Jeff King
2022-10-21 21:48 ` [PATCH 4/4] repack: drop remove_temporary_files() Jeff King
2022-10-21 23:51 ` Taylor Blau
2022-10-22 0:21 ` [PATCH v2 0/5] repack tempfile-cleanup signal deadlock Jeff King
2022-10-22 0:21 ` [PATCH v2 1/5] repack: convert "names" util bitfield to array Jeff King
2022-10-22 0:21 ` [PATCH v2 2/5] repack: populate extension bits incrementally Jeff King
2022-10-22 0:21 ` [PATCH v2 3/5] repack: expand error message for missing pack files Jeff King
2022-10-22 0:21 ` [PATCH v2 4/5] repack: use tempfiles for signal cleanup Jeff King
2022-10-22 20:35 ` Jeff King
2022-10-23 0:14 ` Junio C Hamano
2022-10-23 17:00 ` Jeff King
2022-10-23 18:08 ` Junio C Hamano
2022-10-23 20:55 ` Jeff King
2022-10-23 21:48 ` Junio C Hamano
2022-10-22 0:21 ` [PATCH v2 5/5] repack: drop remove_temporary_files() Jeff King
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=Y1MrXoobkVKngYL1@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=me@ttaylorr.com \
--cc=poki@fnusa.cz \
/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).