Re: [PATCH v6 1/4] config: add support for http.<url>.* settings
- From
Kyle J. McKay <mackyle@gmail.com>
- Date
- Jul 19, 2013, 23:40 UTC
- Message-ID
- <7C9C0DA4-9334-4870-95FD-CF32396753A5@gmail.com>
- In-Reply-To
- <7va9liuxbv.fsf@alter.siamese.dyndns.org>
On Jul 19, 2013, at 13:08, Junio C Hamano wrote:
Show 17 quoted lines
> "Kyle J. McKay" <mackyle@gmail.com> writes: > >> @@ -337,7 +472,7 @@ void http_init(struct remote *remote, const >> char *url, int proactive_auth) >> >> http_is_verbose = 0; >> >> - git_config(http_options, NULL); >> + git_config(http_options, (void *)url); > > Can http_init() be called more than once? max-matched-len (and > leter user-matched as well) is initialized to zero at the link time, > and never reset after it is used for matching the configuration file > entries with a single URL. > > If this function is called more than once, the code needs to > memset(0) the array(s), don't it?
The http_init() function is never called more than once. It's called from http_fetch.c, http_push.c, and remote-curl.c exactly once in the main() function, so no worries. However, I do like your idea of bundling them all up into an on-stack variable, I just didn't want to stick those arrays on the stack if it's not necessary it and it seems like it isn't.
I think I will just go ahead and add the memset to http_init to avoid unexpected breakage if something in the future actually does make multiple http_init()/http_cleanup() calls during its lifetime.
> [...] In any case, you no longer have to cast the second > parameter of git_config to (void *) only to defeat constness ;-)
That goes away in part 4/4 anyhow. :)