@matheusbsbs / matheus-bagliano / commits / 11979b98ad
Fork 0

http.c: reorder to avoid compilation failure.

Move the static function get_curl_handle() around to make sure its definition and declarations are seen by the compiler before its first use. Also remove an unused variable. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Nov 18, 2005 at 17:06 UTC 11979b98adc301fed84122237d0d5a26a360fede
1 file changed +35 -36
http.c
+35 -36
@@ -160,6 +160,41 @@ static int http_options(const char *var, const char *value)
160 return git_default_config(var, value);
161 }
162
163 +static CURL* get_curl_handle(void)
164 +{
165 + CURL* result = curl_easy_init();
166 +
167 + curl_easy_setopt(result, CURLOPT_SSL_VERIFYPEER, curl_ssl_verify);
168 +#if LIBCURL_VERSION_NUM >= 0x070907
169 + curl_easy_setopt(result, CURLOPT_NETRC, CURL_NETRC_OPTIONAL);
170 +#endif
171 +
172 + if (ssl_cert != NULL)
173 + curl_easy_setopt(result, CURLOPT_SSLCERT, ssl_cert);
174 +#if LIBCURL_VERSION_NUM >= 0x070902
175 + if (ssl_key != NULL)
176 + curl_easy_setopt(result, CURLOPT_SSLKEY, ssl_key);
177 +#endif
178 +#if LIBCURL_VERSION_NUM >= 0x070908
179 + if (ssl_capath != NULL)
180 + curl_easy_setopt(result, CURLOPT_CAPATH, ssl_capath);
181 +#endif
182 + if (ssl_cainfo != NULL)
183 + curl_easy_setopt(result, CURLOPT_CAINFO, ssl_cainfo);
184 + curl_easy_setopt(result, CURLOPT_FAILONERROR, 1);
185 +
186 + if (curl_low_speed_limit > 0 && curl_low_speed_time > 0) {
187 + curl_easy_setopt(result, CURLOPT_LOW_SPEED_LIMIT,
188 + curl_low_speed_limit);
189 + curl_easy_setopt(result, CURLOPT_LOW_SPEED_TIME,
190 + curl_low_speed_time);
191 + }
192 +
193 + curl_easy_setopt(result, CURLOPT_FOLLOWLOCATION, 1);
194 +
195 + return result;
196 +}
197 +
198 void http_init(void)
199 {
200 char *low_speed_limit;
@@ -223,7 +258,6 @@ void http_cleanup(void)
258 struct active_request_slot *slot = active_queue_head;
259 #ifdef USE_CURL_MULTI
260 char *wait_url;
226 - CURLMcode curlm_result;
261 #endif
262
263 while (slot != NULL) {
@@ -252,41 +286,6 @@ void http_cleanup(void)
286
287 }
288
255 -static CURL* get_curl_handle(void)
256 -{
257 - CURL* result = curl_easy_init();
258 -
259 - curl_easy_setopt(result, CURLOPT_SSL_VERIFYPEER, curl_ssl_verify);
260 -#if LIBCURL_VERSION_NUM >= 0x070907
261 - curl_easy_setopt(result, CURLOPT_NETRC, CURL_NETRC_OPTIONAL);
262 -#endif
263 -
264 - if (ssl_cert != NULL)
265 - curl_easy_setopt(result, CURLOPT_SSLCERT, ssl_cert);
266 -#if LIBCURL_VERSION_NUM >= 0x070902
267 - if (ssl_key != NULL)
268 - curl_easy_setopt(result, CURLOPT_SSLKEY, ssl_key);
269 -#endif
270 -#if LIBCURL_VERSION_NUM >= 0x070908
271 - if (ssl_capath != NULL)
272 - curl_easy_setopt(result, CURLOPT_CAPATH, ssl_capath);
273 -#endif
274 - if (ssl_cainfo != NULL)
275 - curl_easy_setopt(result, CURLOPT_CAINFO, ssl_cainfo);
276 - curl_easy_setopt(result, CURLOPT_FAILONERROR, 1);
277 -
278 - if (curl_low_speed_limit > 0 && curl_low_speed_time > 0) {
279 - curl_easy_setopt(result, CURLOPT_LOW_SPEED_LIMIT,
280 - curl_low_speed_limit);
281 - curl_easy_setopt(result, CURLOPT_LOW_SPEED_TIME,
282 - curl_low_speed_time);
283 - }
284 -
285 - curl_easy_setopt(result, CURLOPT_FOLLOWLOCATION, 1);
286 -
287 - return result;
288 -}
289 -
289 struct active_request_slot *get_active_slot(void)
290 {
291 struct active_request_slot *slot = active_queue_head;