git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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. :)
Previous: Junio C HamanoNext: Kyle J. McKay
Message 4 of 10 in “config: add support for http.<url>.* settings”
  1. 0/4 config: add support for http.<url>.* settingsKyle J. McKay, Jul 19, 2013
  2. 1/4 config: add support for http.<url>.* settingsKyle J. McKay, Jul 19, 2013
  3. Junio C HamanoJul 19, 2013
  4. Kyle J. McKayJul 19, 2013
  5. 2/4 config: improve support for http.<url>.* settingsKyle J. McKay, Jul 19, 2013
  6. Junio C HamanoJul 19, 2013
  7. Kyle J. McKayJul 19, 2013
  8. Junio C HamanoJul 20, 2013
  9. 3/4 tests: add new test for the url_normalize functionKyle J. McKay, Jul 19, 2013
  10. 4/4 config: allow http.<url>.* any user matchingKyle J. McKay, Jul 19, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.