Re: [PATCH/RFC 2/6] remote-curl.c: fix variable shadowing
On Mon, 2016-04-18 at 11:35 -0700, Junio C Hamano wrote: > David Turnerwrites: > > > The local variable 'options' was shadowing a global of the same > > name. > > > > Signed-off-by: David Turner > > --- > > OK. In general, giving a longer and more descriptive name to the > global would be a direction to lead to more readable code, though. OK, will do that instead. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH/RFC 2/6] remote-curl.c: fix variable shadowing
David Turnerwrites: > The local variable 'options' was shadowing a global of the same name. > > Signed-off-by: David Turner > --- 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(_url, "service=%s", service); > } > > - memset(, 0, sizeof(options)); > - options.content_type = > - options.charset = > - options.effective_url = _url; > - options.base_url = > - options.no_cache = 1; > - options.keep_error = 1; > + memset(_options, 0, sizeof(get_options)); > + get_options.content_type = > + get_options.charset = > + get_options.effective_url = _url; > + get_options.base_url = > + get_options.no_cache = 1; > + get_options.keep_error = 1; > > - http_ret = http_get_strbuf(refs_url.buf, , ); > + http_ret = http_get_strbuf(refs_url.buf, , _options); > switch (http_ret) { > case HTTP_OK: > break; -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC 2/6] remote-curl.c: fix variable shadowing
The local variable 'options' was shadowing a global of the same name. Signed-off-by: David Turner--- 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(_url, "service=%s", service); } - memset(, 0, sizeof(options)); - options.content_type = - options.charset = - options.effective_url = _url; - options.base_url = - options.no_cache = 1; - options.keep_error = 1; + memset(_options, 0, sizeof(get_options)); + get_options.content_type = + get_options.charset = + get_options.effective_url = _url; + get_options.base_url = + get_options.no_cache = 1; + get_options.keep_error = 1; - http_ret = http_get_strbuf(refs_url.buf, , ); + http_ret = http_get_strbuf(refs_url.buf, , _options); switch (http_ret) { case HTTP_OK: break; -- 2.4.2.767.g62658d5-twtrsrc -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html