Skip to contentSkip to conversation

http.c: 'use_git_config_string' on configuration options.

PATCH In review Tordek 4 participants 6 messages Jun 15, 2016 2 messages not in the archive

lore
Share & tools
lore

Tordek

author
#0 lore raw

PATCH 1/1 http.c: 'use_git_config_string' on configuration options.

---
My apologies, I had made a mistake on the previous attempt.

 http.c |   36 ++++++++++++------------------------
 1 files changed, 12 insertions(+), 24 deletions(-)
http.c +12 -24
index 256a5f1..8ae6432 100644
@@ -13,14 +13,14 @@ static CURL *curl_default;
 char curl_errorstr[CURL_ERROR_SIZE];
 
 static int curl_ssl_verify = -1;
-static char *ssl_cert = NULL;
+static const char *ssl_cert = NULL;
 #if LIBCURL_VERSION_NUM >= 0x070902
-static char *ssl_key = NULL;
+static const char *ssl_key = NULL;
 #endif
 #if LIBCURL_VERSION_NUM >= 0x070908
-static char *ssl_capath = NULL;
+static const char *ssl_capath = NULL;
 #endif
-static char *ssl_cainfo = NULL;
+static const char *ssl_cainfo = NULL;
 static long curl_low_speed_limit = -1;
 static long curl_low_speed_time = -1;
 static int curl_ftp_no_epsv = 0;
@@ -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;
 	}
 
Signature · 1 line
1.5.2.2
#1 lore raw

http.c static CURL *curl_default; · line 13

Quoted 13 lines · On Sat, 19 Apr 2008 19:39:21 -0300 Tordek <[email protected]> wrote:

---
My apologies, I had made a mistake on the previous attempt.

  http.c |   36 ++++++++++++------------------------
  1 files changed, 12 insertions(+), 24 deletions(-)
http.c +0 -0
index 256a5f1..8ae6432 100644
@@ -13,14 +13,14 @@ static CURL *curl_default;
  char curl_errorstr[CURL_ERROR_SIZE];

^
There is one spurious whitespace before "char" in the above line.

http.c static CURL *curl_default; · line 15

Quoted 1 line
http.c +0 -0
  static int curl_ssl_verify = -1;

^
In the above line too.

http.c static CURL *curl_default; · line 16

Quoted 2 lines
http.c +1 -1
-static char *ssl_cert = NULL;
+static const char *ssl_cert = NULL;

These 2 lines above are fine.

http.c static CURL *curl_default; · line 16

Quoted 1 line
http.c +0 -0
  #if LIBCURL_VERSION_NUM >= 0x070902

^
Here again there is one spurious whitespace.

[...]

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

Quoted 4 lines
http.c +0 -0
  static long curl_low_speed_time = -1;
  static int curl_ftp_no_epsv = 0;
@@ -100,39 +100,27 @@ static int http_options(const char *var, const 
 char *value)

"char *value)" should have stayed on the same line as "http_options(const char *var, const ".

Please try to send yourself your own patch and try to apply it using "git am", before you send it to the list.

Thanks,
Christian.

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#4 lore raw

---
Okay, I'm skipping the middleman this time; Thunderbird mangles patches...

 http.c |   36 ++++++++++++------------------------
 1 files changed, 12 insertions(+), 24 deletions(-)
http.c +4 -4
index 256a5f1..8ae6432 100644
@@ -13,14 +13,14 @@ static CURL *curl_default;
 char curl_errorstr[CURL_ERROR_SIZE];
 
 static int curl_ssl_verify = -1;
-static char *ssl_cert = NULL;
+static const char *ssl_cert = NULL;
 #if LIBCURL_VERSION_NUM >= 0x070902
-static char *ssl_key = NULL;
+static const char *ssl_key = NULL;
 #endif
 #if LIBCURL_VERSION_NUM >= 0x070908
-static char *ssl_capath = NULL;
+static const char *ssl_capath = NULL;
 #endif
-static char *ssl_cainfo = NULL;
+static const char *ssl_cainfo = NULL;
 static long curl_low_speed_limit = -1;
 static long curl_low_speed_time = -1;
 static int curl_ftp_no_epsv = 0;
@@ -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;
}

Signature · 1 line
1.5.2.2
#5 lore raw
In reply to Tordek
Quoted 3 lines · Tordek

---
My apologies, I had made a mistake on the previous attempt.

Please make up your mind as to who you want to claim to be.

Are you "Tordek <[email protected]>" without first-last name, or are you "Guillermo O Freschi <[email protected]>"?

I suspect the latter, but in that case, it is easier for me if you add an extra From: header at the top of the message. In other words, do this:

(The mail header, RFC 2822)
From: Tordek <[email protected]>
Subject: [PATCH] http.c: use git_config_string() for parsing
Date: .....

(The mail body)
From: Guillermo O. Freschi <[email protected]>

<<explain what the patch does here>>

---
<<commentary, if any>>
<<diffstat>>
<<diff>>

#7 lore raw

Hi,

Quoted 1 line

Heh, Christian, doesn't this patch look _suspiciously_ familiar ;-)?

Yes, you've put a bunch of `sample solutions' to the list and everyone who is able to search Gmane efficiently can find it. But now I wouldn't say that other solutions are cherry-picked from your sample solution even if they look similar. ;-)

Regards,
Stephan

Signature · 1 line
Stephan Beyer <[email protected]>, PGP 0x6EDDD207FCC5040F