git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Kyle J. McKay" <mackyle@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, "David Aguilar" <davvid@gmail.com>,
	"Petr Baudis" <pasky@ucw.cz>,
	"Richard Hartmann" <richih.mailinglist@gmail.com>,
	"Jeff King" <peff@peff.net>,
	"Daniel Knittl-Frank" <knittl89@googlemail.com>,
	"Jan Krüger" <jk@jk.gs>, "Alejandro Mery" <amery@geeks.cl>,
	"Aaron Schrab" <aaron@schrab.com>,
	"Eric Sunshine" <sunshine@sunshineco.com>
Subject: Re: [PATCH v6 1/4] config: add support for http.<url>.* settings
Date: Fri, 19 Jul 2013 16:40:27 -0700	[thread overview]
Message-ID: <7C9C0DA4-9334-4870-95FD-CF32396753A5@gmail.com> (raw)
In-Reply-To: <7va9liuxbv.fsf@alter.siamese.dyndns.org>

On Jul 19, 2013, at 13:08, Junio C Hamano wrote:
> "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. :)

  reply	other threads:[~2013-07-19 23:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-19 12:48 [PATCH v6 0/4] config: add support for http.<url>.* settings Kyle J. McKay
2013-07-19 12:48 ` [PATCH v6 1/4] " Kyle J. McKay
2013-07-19 20:08   ` Junio C Hamano
2013-07-19 23:40     ` Kyle J. McKay [this message]
2013-07-19 12:48 ` [PATCH v6 2/4] config: improve " Kyle J. McKay
2013-07-19 19:59   ` Junio C Hamano
2013-07-19 23:37     ` Kyle J. McKay
2013-07-20  0:35       ` Junio C Hamano
2013-07-19 12:48 ` [PATCH v6 3/4] tests: add new test for the url_normalize function Kyle J. McKay
2013-07-19 12:48 ` [PATCH v6 4/4] config: allow http.<url>.* any user matching Kyle J. McKay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7C9C0DA4-9334-4870-95FD-CF32396753A5@gmail.com \
    --to=mackyle@gmail.com \
    --cc=aaron@schrab.com \
    --cc=amery@geeks.cl \
    --cc=davvid@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jk@jk.gs \
    --cc=knittl89@googlemail.com \
    --cc=pasky@ucw.cz \
    --cc=peff@peff.net \
    --cc=richih.mailinglist@gmail.com \
    --cc=sunshine@sunshineco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).