From: Junio C Hamano <gitster@pobox.com>
To: David Turner <dturner@twopensource.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH/RFC 2/6] remote-curl.c: fix variable shadowing
Date: Mon, 18 Apr 2016 11:35:10 -0700 [thread overview]
Message-ID: <xmqqega26a01.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <1460747949-3514-3-git-send-email-dturner@twopensource.com> (David Turner's message of "Fri, 15 Apr 2016 15:19:05 -0400")
David Turner <dturner@twopensource.com> writes:
> The local variable 'options' was shadowing a global of the same name.
>
> Signed-off-by: David Turner <dturner@twopensource.com>
> ---
OK. In general, giving a longer and more descriptive name to the
global would be a direction to lead to more readable code, though.
> remote-curl.c | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/remote-curl.c b/remote-curl.c
> index 15e48e2..b9b6a90 100644
> --- a/remote-curl.c
> +++ b/remote-curl.c
> @@ -254,7 +254,7 @@ static struct discovery *discover_refs(const char *service, int for_push)
> struct strbuf effective_url = STRBUF_INIT;
> struct discovery *last = last_discovery;
> int http_ret, maybe_smart = 0;
> - struct http_get_options options;
> + struct http_get_options get_options;
>
> if (last && !strcmp(service, last->service))
> return last;
> @@ -271,15 +271,15 @@ static struct discovery *discover_refs(const char *service, int for_push)
> strbuf_addf(&refs_url, "service=%s", service);
> }
>
> - memset(&options, 0, sizeof(options));
> - options.content_type = &type;
> - options.charset = &charset;
> - options.effective_url = &effective_url;
> - options.base_url = &url;
> - options.no_cache = 1;
> - options.keep_error = 1;
> + memset(&get_options, 0, sizeof(get_options));
> + get_options.content_type = &type;
> + get_options.charset = &charset;
> + get_options.effective_url = &effective_url;
> + get_options.base_url = &url;
> + get_options.no_cache = 1;
> + get_options.keep_error = 1;
>
> - http_ret = http_get_strbuf(refs_url.buf, &buffer, &options);
> + http_ret = http_get_strbuf(refs_url.buf, &buffer, &get_options);
> switch (http_ret) {
> case HTTP_OK:
> break;
next prev parent reply other threads:[~2016-04-18 18:35 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-15 19:19 [PATCH/RFC 0/6] fetch with refspec David Turner
2016-04-15 19:19 ` [PATCH/RFC 1/6] http-backend: use argv_array functions David Turner
2016-04-18 18:34 ` Junio C Hamano
2016-04-19 19:11 ` David Turner
2016-04-15 19:19 ` [PATCH/RFC 2/6] remote-curl.c: fix variable shadowing David Turner
2016-04-18 18:35 ` Junio C Hamano [this message]
2016-04-19 19:14 ` David Turner
2016-04-15 19:19 ` [PATCH/RFC 3/6] http-backend: handle refspec argument David Turner
2016-04-17 1:51 ` Eric Sunshine
2016-04-19 18:57 ` David Turner
2016-04-15 19:19 ` [PATCH/RFC 4/6] transport: add refspec list parameters to functions David Turner
2016-04-18 18:45 ` Junio C Hamano
2016-04-19 7:14 ` Jeff King
2016-04-19 18:04 ` Stefan Beller
2016-04-19 20:55 ` Junio C Hamano
2016-04-19 21:40 ` David Turner
2016-04-19 23:22 ` Jeff King
2016-04-19 23:43 ` David Turner
2016-04-20 1:17 ` Jeff King
2016-04-20 20:46 ` David Turner
2016-04-20 20:57 ` Jeff King
2016-04-25 16:44 ` David Turner
2016-04-25 22:10 ` Stefan Beller
2016-04-27 3:59 ` Stefan Beller
2016-04-27 4:11 ` Jeff King
2016-04-27 15:07 ` Junio C Hamano
2016-04-29 23:05 ` David Turner
2016-04-29 23:12 ` Stefan Beller
2016-04-19 19:31 ` David Turner
2016-04-15 19:19 ` [PATCH/RFC 5/6] fetch: pass refspec to http server David Turner
2016-04-17 2:33 ` Eric Sunshine
2016-04-19 21:25 ` David Turner
2016-04-15 19:19 ` [PATCH/RFC 6/6] clone: send refspec for single-branch clones David Turner
2016-04-17 2:36 ` Eric Sunshine
2016-04-19 21:24 ` David Turner
2016-04-15 19:30 ` [PATCH/RFC 0/6] fetch with refspec Stefan Beller
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqega26a01.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=dturner@twopensource.com \
--cc=git@vger.kernel.org \
/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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.