Skip to content

Commit b90a3d7

Browse files
committed
http.c: make finish_active_slot() and handle_curl_result() static
They used to be used directly by remote-curl.c for the smart-http protocol. But they got wrapped by run_one_slot() in beed336 (http: never use curl_easy_perform, 2014-02-18). Any future users are expected to follow that route. Reviewed-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 563d4e5 commit b90a3d7

File tree

2 files changed

+32
-34
lines changed

2 files changed

+32
-34
lines changed

http.c

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,37 @@ size_t fwrite_null(char *ptr, size_t eltsize, size_t nmemb, void *strbuf)
114114
return eltsize * nmemb;
115115
}
116116

117+
static void closedown_active_slot(struct active_request_slot *slot)
118+
{
119+
active_requests--;
120+
slot->in_use = 0;
121+
}
122+
123+
static void finish_active_slot(struct active_request_slot *slot)
124+
{
125+
closedown_active_slot(slot);
126+
curl_easy_getinfo(slot->curl, CURLINFO_HTTP_CODE, &slot->http_code);
127+
128+
if (slot->finished != NULL)
129+
(*slot->finished) = 1;
130+
131+
/* Store slot results so they can be read after the slot is reused */
132+
if (slot->results != NULL) {
133+
slot->results->curl_result = slot->curl_result;
134+
slot->results->http_code = slot->http_code;
135+
#if LIBCURL_VERSION_NUM >= 0x070a08
136+
curl_easy_getinfo(slot->curl, CURLINFO_HTTPAUTH_AVAIL,
137+
&slot->results->auth_avail);
138+
#else
139+
slot->results->auth_avail = 0;
140+
#endif
141+
}
142+
143+
/* Run callback if appropriate */
144+
if (slot->callback_func != NULL)
145+
slot->callback_func(slot->callback_data);
146+
}
147+
117148
#ifdef USE_CURL_MULTI
118149
static void process_curl_messages(void)
119150
{
@@ -730,12 +761,6 @@ void run_active_slot(struct active_request_slot *slot)
730761
#endif
731762
}
732763

733-
static void closedown_active_slot(struct active_request_slot *slot)
734-
{
735-
active_requests--;
736-
slot->in_use = 0;
737-
}
738-
739764
static void release_active_slot(struct active_request_slot *slot)
740765
{
741766
closedown_active_slot(slot);
@@ -752,31 +777,6 @@ static void release_active_slot(struct active_request_slot *slot)
752777
#endif
753778
}
754779

755-
void finish_active_slot(struct active_request_slot *slot)
756-
{
757-
closedown_active_slot(slot);
758-
curl_easy_getinfo(slot->curl, CURLINFO_HTTP_CODE, &slot->http_code);
759-
760-
if (slot->finished != NULL)
761-
(*slot->finished) = 1;
762-
763-
/* Store slot results so they can be read after the slot is reused */
764-
if (slot->results != NULL) {
765-
slot->results->curl_result = slot->curl_result;
766-
slot->results->http_code = slot->http_code;
767-
#if LIBCURL_VERSION_NUM >= 0x070a08
768-
curl_easy_getinfo(slot->curl, CURLINFO_HTTPAUTH_AVAIL,
769-
&slot->results->auth_avail);
770-
#else
771-
slot->results->auth_avail = 0;
772-
#endif
773-
}
774-
775-
/* Run callback if appropriate */
776-
if (slot->callback_func != NULL)
777-
slot->callback_func(slot->callback_data);
778-
}
779-
780780
void finish_all_active_slots(void)
781781
{
782782
struct active_request_slot *slot = active_queue_head;
@@ -839,7 +839,7 @@ char *get_remote_object_url(const char *url, const char *hex,
839839
return strbuf_detach(&buf, NULL);
840840
}
841841

842-
int handle_curl_result(struct slot_results *results)
842+
static int handle_curl_result(struct slot_results *results)
843843
{
844844
/*
845845
* If we see a failing http code with CURLE_OK, we have turned off

http.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,7 @@ extern curlioerr ioctl_buffer(CURL *handle, int cmd, void *clientp);
8585
extern struct active_request_slot *get_active_slot(void);
8686
extern int start_active_slot(struct active_request_slot *slot);
8787
extern void run_active_slot(struct active_request_slot *slot);
88-
extern void finish_active_slot(struct active_request_slot *slot);
8988
extern void finish_all_active_slots(void);
90-
extern int handle_curl_result(struct slot_results *results);
9189

9290
/*
9391
* This will run one slot to completion in a blocking manner, similar to how

0 commit comments

Comments
 (0)