Skip to contentSkip to conversation

http.c: use 'git_config_string' on configuration options.

PATCH In review Tordek 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore

Tordek

author
#0 lore raw

PATCH 1/1 http.c: use 'git_config_string' on configuration options.

---
 http.c |   35 ++++++++++-------------------------
 1 files changed, 10 insertions(+), 25 deletions(-)
http.c +0 -0
index 256a5f1..cadc1bf 100644
@@ -100,39 +100,27 @@ static int http_options(const char *var, const

char *value)

        }

        if (!strcmp("http.sslcert", var)) {

- if (ssl_cert == NULL) {
- if (!value)
- return config_error_nonbool(var);
- ssl_cert = xstrdup(value);
- }
+ if (ssl_cert == NULL)

+                       return git_config_string(&ssl_cert, var, value);
                return 0;
        }
 #if LIBCURL_VERSION_NUM >= 0x070902
        if (!strcmp("http.sslkey", var)) {

- if (ssl_key == NULL) {
- if (!value)
- return config_error_nonbool(var);
- ssl_key = xstrdup(value);
- }
+ if (ssl_key == NULL)

+                       return git_config_string(&ssl_key, var, value);
                return 0;
        }
 #endif
 #if LIBCURL_VERSION_NUM >= 0x070908
        if (!strcmp("http.sslcapath", var)) {

- if (ssl_capath == NULL) {
- if (!value)
- return config_error_nonbool(var);
- ssl_capath = xstrdup(value);
- }
+ if (ssl_capath == NULL)

+                       return git_config_string(&ssl_capath, var, value);
                return 0;
        }
 #endif
        if (!strcmp("http.sslcainfo", var)) {

- if (ssl_cainfo == NULL) {
- if (!value)
- return config_error_nonbool(var);
- ssl_cainfo = xstrdup(value);
- }
+ if (ssl_cainfo == NULL)

+                       return git_config_string(&ssl_cainfo, var, value);
                return 0;
        }

@@ -160,11 +148,8 @@ static int http_options(const char *var, const char *value)

                return 0;
        }
        if (!strcmp("http.proxy", var)) {

- if (curl_http_proxy == NULL) {
- if (!value)
- return config_error_nonbool(var);
- curl_http_proxy = xstrdup(value);
- }
+ if (curl_http_proxy == NULL)
+ return git_config_string(&curl_http_proxy, var,

value);
                return 0;
        }

--
1.5.2.2

#1 lore raw
Quoted 13 lines · Tordek
---
 http.c |   35 ++++++++++-------------------------
 1 files changed, 10 insertions(+), 25 deletions(-)
http.c +0 -0
index 256a5f1..cadc1bf 100644
@@ -100,39 +100,27 @@ static int http_options(const char *var, const
 char *value)
        }
 

http.c static int http_options(const char *var, const · line 107

Quoted 10 lines
http.c +2 -5
        if (!strcmp("http.sslcert", var)) {
-               if (ssl_cert == NULL) {
-                       if (!value)
-                               return config_error_nonbool(var);
-                       ssl_cert = xstrdup(value);
-               }
+               if (ssl_cert == NULL)
+                       return git_config_string(&ssl_cert, var, value);
                return 0;
        }

Did you check that there is no compile warnings resulting from this ? Did you read the last sentences of http://git.or.cz/gitwiki/Janitor ?

By the way it seems that your patch has spaces instead of tabs everywhere.

Thanks,
Christian.