Re: [PATCH v2] connect.c: remove a few globals by using git_config callback data

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

 



Hi,

On Wed, 11 Mar 2009, Erik Faye-Lund wrote:

> Since ef90d6d (Provide git_config with a callback-data parameter,
> 2008-05-14), git_config() takes a callback data pointer that can be
> used to pass extra parameters to the parsing function.  The codepath
> to parse configuration variables related to git proxy predates this
> facility and used a pair of file scope static variables instead.
> 
> This patch removes the need for these global variables by passing the
> name of the host we are trying to access as the callback data.
> 
> Signed-off-by: Erik Faye-Lund <kusmabite@xxxxxxxxx>

Thanks!

> @@ -383,6 +381,8 @@ static int git_proxy_command_options(const char *var, const char *value,
>  		const char *for_pos;
>  		int matchlen = -1;
>  		int hostlen;
> +		const char *rhost_name = cb;
> +		int rhost_len = strlen(rhost_name);

I see that you still calculate the length everytime 
git_proxy_command_options() is called -- which is for every config 
variable.

> @@ -426,11 +426,8 @@ static int git_proxy_command_options(const char *var, const char *value,
>  
>  static int git_use_proxy(const char *host)
>  {
> -	rhost_name = host;
> -	rhost_len = strlen(host);
>  	git_proxy_command = getenv("GIT_PROXY_COMMAND");
> -	git_config(git_proxy_command_options, NULL);
> -	rhost_name = NULL;
> +	git_config(git_proxy_command_options, (void*)host);

The (void *) should not be needed.

Thanks,
Dscho

--
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]

  Powered by Linux