On 19/04/16 22:48, Ramsay Jones wrote: > [snip] > I think the minimal fixup (including Junio's comment on patch #2, which also > triggered for me) is given in the patch below. BTW, if you want to have a single static instance of the 'struct trace_key', then the following patch on top should work. (Also, I have compiled and run the testsuite on these patches, but _not_ tested that the trace functionality actually works!) ;-) HTH ATB, Ramsay Jones -- >8 -- Subject: [PATCH] curl-trace: reduce visibility of the trace key struct Signed-off-by: Ramsay Jones <ramsay@xxxxxxxxxxxxxxxxxxxx> --- http.c | 9 +++++++-- http.h | 2 +- imap-send.c | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/http.c b/http.c index ce91421..eed6dba 100644 --- a/http.c +++ b/http.c @@ -11,7 +11,7 @@ #include "gettext.h" #include "transport.h" -struct trace_key trace_curl = TRACE_KEY_INIT(CURL); +static struct trace_key trace_curl = TRACE_KEY_INIT(CURL); #if LIBCURL_VERSION_NUM >= 0x070a08 long int git_curl_ipresolve = CURL_IPRESOLVE_WHATEVER; #else @@ -516,6 +516,11 @@ static void curl_dump(const char *text, unsigned char *ptr, size_t size, char no } } +int curl_trace_want(void) +{ + return trace_want(&trace_curl); +} + int curl_trace(CURL *handle, curl_infotype type, char *data, size_t size, void *userp) { @@ -652,7 +657,7 @@ static CURL *get_curl_handle(void) "your curl version is too old (>= 7.19.4)"); #endif - if (trace_want(&trace_curl)) { + if (curl_trace_want()) { curl_easy_setopt(result, CURLOPT_VERBOSE, 1L); curl_easy_setopt(result, CURLOPT_DEBUGFUNCTION, curl_trace); curl_easy_setopt(result, CURLOPT_DEBUGDATA, NULL); diff --git a/http.h b/http.h index 00e4ad7..153ff17 100644 --- a/http.h +++ b/http.h @@ -225,7 +225,7 @@ extern void abort_http_object_request(struct http_object_request *freq); extern void release_http_object_request(struct http_object_request *freq); /* Debug callback and helper routine for curl_easy_setopt CURLOPT_DEBUGFUNCTION */ -extern struct trace_key trace_curl; +int curl_trace_want(void); int curl_trace(CURL *handle, curl_infotype type, char *data, size_t size, void *userp); diff --git a/imap-send.c b/imap-send.c index 36ff843..627ffa4 100644 --- a/imap-send.c +++ b/imap-send.c @@ -1444,7 +1444,7 @@ static CURL *setup_curl(struct imap_server_conf *srvc) if (0 < verbosity || getenv("GIT_CURL_VERBOSE")) curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); - if (trace_want(&trace_curl)) { + if (curl_trace_want()) { curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, curl_trace); curl_easy_setopt(curl, CURLOPT_DEBUGDATA, NULL); -- 2.8.0 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html