From: Jeff King <peff@peff.net>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH 0/5] *.[ch]: don't duplicate *_init() and *_INIT logic
Date: Thu, 1 Jul 2021 12:13:13 -0400 [thread overview]
Message-ID: <YN3pmS8q3dA3Gnd+@coredump.intra.peff.net> (raw)
In-Reply-To: <cover-0.5-00000000000-20210701T104855Z-avarab@gmail.com>
On Thu, Jul 01, 2021 at 12:51:24PM +0200, Ævar Arnfjörð Bjarmason wrote:
> This series implements a suggestion by Jeff King to use an idiom for
> *_init() functions that avoids duplicating what we've declared in the
> corresponding *_INIT macros. See
> https://lore.kernel.org/git/YNytp0JAIaQih0Y4@coredump.intra.peff.net/
These all look pretty good to me. My comments are minor enough that I'll
include them here rather than individual replies:
> Ævar Arnfjörð Bjarmason (5):
> *.h: move some *_INIT to designated initializers
I agree with Martin's suggestion to prefer the designated initializer
for STRING_LIST_INIT_NODUP. The consistency makes it easier to read.
> *.c *_init(): define in terms of corresponding *_INIT macro
Yep, nice.
> dir.[ch]: replace dir_init() with DIR_INIT
I like this. Since there is a dir_clear(), I guess somebody could argue
that lacking an init function makes things less consistent/balanced. But
if we don't need it, I'm happy to drop it.
> string-list.[ch]: add a string_list_init_{nodup,dup}()
I like this. I agree the current "0/1" in the callers is kind of
inscrutable. It does make things harder if we wanted to add more
options, but that is already true due to the macro initializers.
> string-list.h users: change to use *_{nodup,dup}()
Nice. IMHO you should drop the convenience wrapper here. Leaving it
means we'll have to circle back later and fix up topics in flight (and
it's not atomic; when we finally drop it, there may be more topics in
flight then!).
If it were somehow complicated to convert callers, that might be more
justified. But doing a quick conversion (which is easily detected by the
compiler) in the merge commit seems like less work than having to
revisit the topic later.
-Peff
prev parent reply other threads:[~2021-07-01 16:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-01 10:51 [PATCH 0/5] *.[ch]: don't duplicate *_init() and *_INIT logic Ævar Arnfjörð Bjarmason
2021-07-01 10:51 ` [PATCH 1/5] *.h: move some *_INIT to designated initializers Ævar Arnfjörð Bjarmason
2021-07-01 15:00 ` Martin Ågren
2021-07-01 15:56 ` Junio C Hamano
2021-07-01 16:08 ` Ævar Arnfjörð Bjarmason
2021-07-01 10:51 ` [PATCH 2/5] *.c *_init(): define in terms of corresponding *_INIT macro Ævar Arnfjörð Bjarmason
2021-07-01 10:51 ` [PATCH 3/5] dir.[ch]: replace dir_init() with DIR_INIT Ævar Arnfjörð Bjarmason
2021-07-01 10:51 ` [PATCH 4/5] string-list.[ch]: add a string_list_init_{nodup,dup}() Ævar Arnfjörð Bjarmason
2021-07-01 10:51 ` [PATCH 5/5] string-list.h users: change to use *_{nodup,dup}() Ævar Arnfjörð Bjarmason
2021-07-01 16:13 ` Jeff King [this message]
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YN3pmS8q3dA3Gnd+@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).