git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: git@vger.kernel.org, "Jeff King" <peff@peff.net>,
	"Martin Ågren" <martin.agren@gmail.com>,
	"Phillip Wood" <phillip.wood123@gmail.com>
Subject: Re: [PATCH v2 3/5] urlmatch.[ch]: add and use URLMATCH_CONFIG_INIT
Date: Mon, 27 Sep 2021 15:12:38 -0700	[thread overview]
Message-ID: <xmqq8rzhoeg9.fsf@gitster.g> (raw)
In-Reply-To: <patch-v2-3.5-3783788b553-20210927T125715Z-avarab@gmail.com> (=?utf-8?B?IsOGdmFyIEFybmZqw7Zyw7A=?= Bjarmason"'s message of "Mon, 27 Sep 2021 14:58:43 +0200")

Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:

> @@ -575,11 +575,10 @@ static int get_urlmatch(const char *var, const char *url)
>  	int ret;
>  	char *section_tail;
>  	struct string_list_item *item;
> -	struct urlmatch_config config = { STRING_LIST_INIT_DUP };
> +	struct urlmatch_config config = URLMATCH_CONFIG_INIT;

While I think this is much easier to follow than the original, I am
not quite sure about the removal of these explicit _assignments_ in
code, like this ...

>  	config.collect_fn = urlmatch_collect_fn;
> -	config.cascade_fn = NULL;
>  	config.cb = &values;

and this ...

>  	config.section = "credential";
> -	config.key = NULL;
>  	config.collect_fn = credential_config_callback;
> -	config.cascade_fn = NULL;
>  	config.select_fn = select_all;

and this ...

>  	config.section = "http";
> -	config.key = NULL;
>  	config.collect_fn = http_options;
>  	config.cascade_fn = git_default_config;
> -	config.cb = NULL;

as they have documentation value (e.g. "for this invocation I do
want to use no cascade_fn" is a statement worth making, by having
it next to the assignment to .collect_fn member).


  reply	other threads:[~2021-09-27 22:12 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-27  0:53 [PATCH 0/6] Non-trivial designated initializer conversion Ævar Arnfjörð Bjarmason
2021-09-27  0:53 ` [PATCH 1/6] daemon.c: refactor hostinfo_init() to HOSTINFO_INIT macro Ævar Arnfjörð Bjarmason
2021-09-27  0:53 ` [PATCH 2/6] builtin/blame.c: refactor commit_info_init() to COMMIT_INFO_INIT macro Ævar Arnfjörð Bjarmason
2021-09-27  0:53 ` [PATCH 3/6] shortlog: use designated initializer for "struct shortlog" Ævar Arnfjörð Bjarmason
2021-09-27  9:06   ` Phillip Wood
2021-09-27 10:52     ` Ævar Arnfjörð Bjarmason
2021-09-27  0:53 ` [PATCH 4/6] urlmatch.[ch]: add and use URLMATCH_CONFIG_INIT Ævar Arnfjörð Bjarmason
2021-09-27  0:53 ` [PATCH 5/6] builtin/remote.c: add and use a REF_STATES_INIT Ævar Arnfjörð Bjarmason
2021-09-27  0:53 ` [PATCH 6/6] builtin/remote.c: add and use SHOW_INFO_INIT Ævar Arnfjörð Bjarmason
2021-09-27 12:58 ` [PATCH v2 0/5] Non-trivial designated initializer conversion Ævar Arnfjörð Bjarmason
2021-09-27 12:58   ` [PATCH v2 1/5] daemon.c: refactor hostinfo_init() to HOSTINFO_INIT macro Ævar Arnfjörð Bjarmason
2021-09-27 12:58   ` [PATCH v2 2/5] builtin/blame.c: refactor commit_info_init() to COMMIT_INFO_INIT macro Ævar Arnfjörð Bjarmason
2021-09-27 12:58   ` [PATCH v2 3/5] urlmatch.[ch]: add and use URLMATCH_CONFIG_INIT Ævar Arnfjörð Bjarmason
2021-09-27 22:12     ` Junio C Hamano [this message]
2021-09-27 12:58   ` [PATCH v2 4/5] builtin/remote.c: add and use a REF_STATES_INIT Ævar Arnfjörð Bjarmason
2021-09-27 23:04     ` Junio C Hamano
2021-09-27 23:38       ` Ævar Arnfjörð Bjarmason
2021-09-27 23:56         ` Junio C Hamano
2021-09-27 12:58   ` [PATCH v2 5/5] builtin/remote.c: add and use SHOW_INFO_INIT Ævar Arnfjörð Bjarmason
2021-10-01 10:27   ` [PATCH v3 0/6] Non-trivial designated initializer conversion Ævar Arnfjörð Bjarmason
2021-10-01 10:27     ` [PATCH v3 1/6] daemon.c: refactor hostinfo_init() to HOSTINFO_INIT macro Ævar Arnfjörð Bjarmason
2021-10-01 10:27     ` [PATCH v3 2/6] builtin/blame.c: refactor commit_info_init() to COMMIT_INFO_INIT macro Ævar Arnfjörð Bjarmason
2021-10-01 10:27     ` [PATCH v3 3/6] urlmatch.[ch]: add and use URLMATCH_CONFIG_INIT Ævar Arnfjörð Bjarmason
2021-10-01 10:27     ` [PATCH v3 4/6] builtin/remote.c: add and use a REF_STATES_INIT Ævar Arnfjörð Bjarmason
2021-10-01 10:27     ` [PATCH v3 5/6] builtin/remote.c: add and use SHOW_INFO_INIT Ævar Arnfjörð Bjarmason
2021-10-01 10:27     ` [PATCH v3 6/6] unpack-trees.[ch]: define and use a UNPACK_TREES_OPTIONS_INIT Ævar Arnfjörð Bjarmason
2021-10-01 21:39       ` Junio C Hamano
2021-10-02 20:16     ` [PATCH v4 0/5] Non-trivial designated initializer conversion Ævar Arnfjörð Bjarmason
2021-10-02 20:16       ` [PATCH v4 1/5] daemon.c: refactor hostinfo_init() to HOSTINFO_INIT macro Ævar Arnfjörð Bjarmason
2021-10-02 20:16       ` [PATCH v4 2/5] builtin/blame.c: refactor commit_info_init() to COMMIT_INFO_INIT macro Ævar Arnfjörð Bjarmason
2021-10-02 20:16       ` [PATCH v4 3/5] urlmatch.[ch]: add and use URLMATCH_CONFIG_INIT Ævar Arnfjörð Bjarmason
2021-10-02 20:16       ` [PATCH v4 4/5] builtin/remote.c: add and use a REF_STATES_INIT Ævar Arnfjörð Bjarmason
2021-10-02 20:16       ` [PATCH v4 5/5] builtin/remote.c: add and use SHOW_INFO_INIT Ævar Arnfjörð Bjarmason

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=xmqq8rzhoeg9.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=martin.agren@gmail.com \
    --cc=peff@peff.net \
    --cc=phillip.wood123@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).