Skip to content

Commit d8b6b84

Browse files
Eric Wonggitster
authored andcommitted
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>
1 parent 9f1b588 commit d8b6b84

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

http.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,13 @@ static void finish_active_slot(struct active_request_slot *slot)
167167
slot->callback_func(slot->callback_data);
168168
}
169169

170+
static void xmulti_remove_handle(struct active_request_slot *slot)
171+
{
172+
#ifdef USE_CURL_MULTI
173+
curl_multi_remove_handle(curlm, slot->curl);
174+
#endif
175+
}
176+
170177
#ifdef USE_CURL_MULTI
171178
static void process_curl_messages(void)
172179
{
@@ -182,7 +189,7 @@ static void process_curl_messages(void)
182189
slot->curl != curl_message->easy_handle)
183190
slot = slot->next;
184191
if (slot != NULL) {
185-
curl_multi_remove_handle(curlm, slot->curl);
192+
xmulti_remove_handle(slot);
186193
slot->curl_result = curl_result;
187194
finish_active_slot(slot);
188195
} else {
@@ -588,9 +595,7 @@ void http_cleanup(void)
588595
while (slot != NULL) {
589596
struct active_request_slot *next = slot->next;
590597
if (slot->curl != NULL) {
591-
#ifdef USE_CURL_MULTI
592-
curl_multi_remove_handle(curlm, slot->curl);
593-
#endif
598+
xmulti_remove_handle(slot);
594599
curl_easy_cleanup(slot->curl);
595600
}
596601
free(slot);
@@ -851,9 +856,7 @@ static void release_active_slot(struct active_request_slot *slot)
851856
{
852857
closedown_active_slot(slot);
853858
if (slot->curl && curl_session_count > min_curl_sessions) {
854-
#ifdef USE_CURL_MULTI
855-
curl_multi_remove_handle(curlm, slot->curl);
856-
#endif
859+
xmulti_remove_handle(slot);
857860
curl_easy_cleanup(slot->curl);
858861
slot->curl = NULL;
859862
curl_session_count--;

0 commit comments

Comments
 (0)