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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Jan 14, 2015 at 15:40 UTC
b90a3d7b3275fdb23184dce7afc2aaeaaafb8886
2 files changed
+32
-34
http.c
+32
-32
@@ -114,6 +114,37 @@ size_t fwrite_null(char *ptr, size_t eltsize, size_t nmemb, void *strbuf)
114
return eltsize * nmemb;
115
}
116
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
+
148
#ifdef USE_CURL_MULTI
149
static void process_curl_messages(void)
150
{
@@ -730,12 +761,6 @@ void run_active_slot(struct active_request_slot *slot)
761
#endif
762
}
763
733
-static void closedown_active_slot(struct active_request_slot *slot)
734
-{
735
- active_requests--;
736
- slot->in_use = 0;
737
-}
738
-
764
static void release_active_slot(struct active_request_slot *slot)
765
{
766
closedown_active_slot(slot);
@@ -752,31 +777,6 @@ static void release_active_slot(struct active_request_slot *slot)
777
#endif
778
}
779
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
-
780
void finish_all_active_slots(void)
781
{
782
struct active_request_slot *slot = active_queue_head;
@@ -839,7 +839,7 @@ char *get_remote_object_url(const char *url, const char *hex,
839
return strbuf_detach(&buf, NULL);
840
}
841
842
-int handle_curl_result(struct slot_results *results)
842
+static int handle_curl_result(struct slot_results *results)
843
{
844
/*
845
* If we see a failing http code with CURLE_OK, we have turned off
http.h
-2
@@ -85,9 +85,7 @@ extern curlioerr ioctl_buffer(CURL *handle, int cmd, void *clientp);
85
extern struct active_request_slot *get_active_slot(void);
86
extern int start_active_slot(struct active_request_slot *slot);
87
extern void run_active_slot(struct active_request_slot *slot);
88
-extern void finish_active_slot(struct active_request_slot *slot);
88
extern void finish_all_active_slots(void);
90
-extern int handle_curl_result(struct slot_results *results);
89
90
/*
91
* This will run one slot to completion in a blocking manner, similar to how