Re: [PATCH v2 3/5] urlmatch.[ch]: add and use URLMATCH_CONFIG_INIT
From: Junio C Hamano <hidden>
Date: 2021-09-27 22:12:42
Ævar Arnfjörð Bjarmason [off-list ref] writes:
quoted hunk
@@ -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).