diff options
author | Eric Wong <e@80x24.org> | 2016-09-13 00:25:56 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-09-13 13:34:03 -0700 |
commit | d8b6b84df024b4ce2c10d7e5c725da24dcb19ff6 (patch) | |
tree | 486002f018035d9a7c09ec37f8d5c8c0e6f44728 /http.c | |
parent | 9f1b58842a44e8f0dc8fb4a447449cb31957b4bf (diff) | |
download | git-d8b6b84df024b4ce2c10d7e5c725da24dcb19ff6.tar.gz |
http: consolidate #ifdefs for curl_multi_remove_handle
I find #ifdefs makes code difficult-to-follow.
An early version of this patch had error checking for
curl_multi_remove_handle calls, but caused some tests (e.g.
t5541) to fail under curl 7.26.0 on old Debian wheezy.
Signed-off-by: Eric Wong <e@80x24.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'http.c')
-rw-r--r-- | http.c | 17 |
1 files changed, 10 insertions, 7 deletions
@@ -167,6 +167,13 @@ static void finish_active_slot(struct active_request_slot *slot) slot->callback_func(slot->callback_data); } +static void xmulti_remove_handle(struct active_request_slot *slot) +{ +#ifdef USE_CURL_MULTI + curl_multi_remove_handle(curlm, slot->curl); +#endif +} + #ifdef USE_CURL_MULTI static void process_curl_messages(void) { @@ -182,7 +189,7 @@ static void process_curl_messages(void) slot->curl != curl_message->easy_handle) slot = slot->next; if (slot != NULL) { - curl_multi_remove_handle(curlm, slot->curl); + xmulti_remove_handle(slot); slot->curl_result = curl_result; finish_active_slot(slot); } else { @@ -588,9 +595,7 @@ void http_cleanup(void) while (slot != NULL) { struct active_request_slot *next = slot->next; if (slot->curl != NULL) { -#ifdef USE_CURL_MULTI - curl_multi_remove_handle(curlm, slot->curl); -#endif + xmulti_remove_handle(slot); curl_easy_cleanup(slot->curl); } free(slot); @@ -851,9 +856,7 @@ static void release_active_slot(struct active_request_slot *slot) { closedown_active_slot(slot); if (slot->curl && curl_session_count > min_curl_sessions) { -#ifdef USE_CURL_MULTI - curl_multi_remove_handle(curlm, slot->curl); -#endif + xmulti_remove_handle(slot); curl_easy_cleanup(slot->curl); slot->curl = NULL; curl_session_count--; |