git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] http.c: use 'git_config_string' on configuration options.
@ 2008-04-18 13:17 Tordek
  2008-04-19  5:16 ` Christian Couder
  0 siblings, 1 reply; 2+ messages in thread
From: Tordek @ 2008-04-18 13:17 UTC (permalink / raw)
  To: git

Signed-off-by: Guillermo O. Freschi <tordek@tordek.com.ar>
---
 http.c |   35 ++++++++++-------------------------
 1 files changed, 10 insertions(+), 25 deletions(-)

diff --git a/http.c b/http.c
index 256a5f1..cadc1bf 100644
--- a/http.c
+++ b/http.c
@@ -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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] http.c: use 'git_config_string' on configuration options.
  2008-04-18 13:17 [PATCH] http.c: use 'git_config_string' on configuration options Tordek
@ 2008-04-19  5:16 ` Christian Couder
  0 siblings, 0 replies; 2+ messages in thread
From: Christian Couder @ 2008-04-19  5:16 UTC (permalink / raw)
  To: Tordek; +Cc: git

Le vendredi 18 avril 2008, Tordek a écrit :
> Signed-off-by: Guillermo O. Freschi <tordek@tordek.com.ar>
> ---
>  http.c |   35 ++++++++++-------------------------
>  1 files changed, 10 insertions(+), 25 deletions(-)
>
> diff --git a/http.c b/http.c
> index 256a5f1..cadc1bf 100644
> --- a/http.c
> +++ b/http.c
> @@ -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;
>         }

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-04-19  5:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-18 13:17 [PATCH] http.c: use 'git_config_string' on configuration options Tordek
2008-04-19  5:16 ` Christian Couder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).