Re: [PATCH v2 3/5] urlmatch.[ch]: add and use URLMATCH_CONFIG_INIT
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 27, 2021, 22:12 UTC
- Message-ID
- <xmqq8rzhoeg9.fsf@gitster.g>
- In-Reply-To
- <patch-v2-3.5-3783788b553-20210927T125715Z-avarab@gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 6 quoted lines
> @@ -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 ...
Show 5 quoted lines
> config.section = "credential"; > - config.key = NULL; > config.collect_fn = credential_config_callback; > - config.cascade_fn = NULL; > config.select_fn = select_all;
and this ...
Show 5 quoted lines
> 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).