1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-04-23 09:05:08 +02:00

urlmatch.[ch]: add and use URLMATCH_CONFIG_INIT

Change the initialization pattern of "struct urlmatch_config" to use
an *_INIT macro and designated initializers. Right now there's no
other "struct" member of "struct urlmatch_config" which would require
its own *_INIT, but it's good practice not to assume that. Let's also
change this to a designated initializer while we're at it.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Ævar Arnfjörð Bjarmason 2021-10-01 12:27:33 +02:00 committed by Junio C Hamano
parent 4eb2bfdc92
commit 73ee449bbf
4 changed files with 7 additions and 3 deletions

View File

@ -575,7 +575,7 @@ 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;
struct string_list values = STRING_LIST_INIT_DUP;
config.collect_fn = urlmatch_collect_fn;

View File

@ -105,7 +105,7 @@ static int match_partial_url(const char *url, void *cb)
static void credential_apply_config(struct credential *c)
{
char *normalized_url;
struct urlmatch_config config = { STRING_LIST_INIT_DUP };
struct urlmatch_config config = URLMATCH_CONFIG_INIT;
struct strbuf url = STRBUF_INIT;
if (!c->host)

2
http.c
View File

@ -990,7 +990,7 @@ void http_init(struct remote *remote, const char *url, int proactive_auth)
char *low_speed_limit;
char *low_speed_time;
char *normalized_url;
struct urlmatch_config config = { STRING_LIST_INIT_DUP };
struct urlmatch_config config = URLMATCH_CONFIG_INIT;
config.section = "http";
config.key = NULL;

View File

@ -66,6 +66,10 @@ struct urlmatch_config {
int (*fallback_match_fn)(const char *url, void *cb);
};
#define URLMATCH_CONFIG_INIT { \
.vars = STRING_LIST_INIT_DUP, \
}
int urlmatch_config_entry(const char *var, const char *value, void *cb);
#endif /* URL_MATCH_H */