Re: [PATCH/RFC 2/6] remote-curl.c: fix variable shadowing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



David Turner <dturner@xxxxxxxxxxxxxxxx> writes:

> The local variable 'options' was shadowing a global of the same name.
>
> Signed-off-by: David Turner <dturner@xxxxxxxxxxxxxxxx>
> ---

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;
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]