Thread (1 message) 1 message, 1 author, 2021-09-09

Re: [PATCH 5/5] http: don't hardcode the value of CURL_SOCKOPT_OK

From: Junio C Hamano <hidden>
Date: 2021-09-09 23:15:24

Ævar Arnfjörð Bjarmason  [off-list ref] writes:
quoted hunk
+/**
+ * CURL_SOCKOPT_OK was added in 7.21.5, released in April 2011.
+ */
+#ifndef CURL_SOCKOPT_OK
+#define CURL_SOCKOPT_OK 0
+#endif
+
 /**
  * CURLOPT_TCP_KEEPALIVE was added in 7.25.0, released in March 2012.
  */
diff --git a/http.c b/http.c
index e38fcc34d64..c40439d39ce 100644
--- a/http.c
+++ b/http.c
@@ -533,7 +533,7 @@ static int sockopt_callback(void *client, curl_socket_t fd, curlsocktype type)
 	if (rc < 0)
 		warning_errno("unable to set SO_KEEPALIVE on socket");
 
-	return 0; /* CURL_SOCKOPT_OK only exists since curl 7.21.5 */
+	return CURL_SOCKOPT_OK;
 }
This is much better than the one in the previous round where an
extra CPP macro with GIT_CURL_SOCKOPT_OK_AVAILABLE or some other
name was used to conditionally return 0 or CURL_SOCKOPT_OK.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help