aboutsummaryrefslogtreecommitdiff
path: root/connect.c
diff options
context:
space:
mode:
authorErik Faye-Lund <kusmabite@gmail.com>2009-03-11 02:38:12 +0000
committerJunio C Hamano <gitster@pobox.com>2009-03-10 21:42:58 -0700
commit15112c9599f99487211855db7a7a347f20ad9ed5 (patch)
tree82f30cf82e5714daee527fccb65f6f4b5b4f3f68 /connect.c
parentc4994ce953b4f0fdbf80004da24ef845907d7dd8 (diff)
downloadgit-15112c9599f99487211855db7a7a347f20ad9ed5.tar.gz
git-15112c9599f99487211855db7a7a347f20ad9ed5.tar.xz
connect.c: remove a few globals by using git_config callback data
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@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'connect.c')
-rw-r--r--connect.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/connect.c b/connect.c
index 2f23ab3b8..0a35cc1b2 100644
--- a/connect.c
+++ b/connect.c
@@ -373,8 +373,6 @@ static void git_tcp_connect(int fd[2], char *host, int flags)
static char *git_proxy_command;
-static const char *rhost_name;
-static int rhost_len;
static int git_proxy_command_options(const char *var, const char *value,
void *cb)
@@ -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);
if (git_proxy_command)
return 0;
@@ -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);
return (git_proxy_command && *git_proxy_command);
}