1
1
#include "http.h"
2
2
3
3
int data_received ;
4
- int active_requests = 0 ;
4
+ int active_requests ;
5
5
6
6
#ifdef USE_CURL_MULTI
7
7
static int max_requests = -1 ;
@@ -13,22 +13,22 @@ static CURL *curl_default;
13
13
char curl_errorstr [CURL_ERROR_SIZE ];
14
14
15
15
static int curl_ssl_verify = -1 ;
16
- static const char * ssl_cert = NULL ;
16
+ static const char * ssl_cert ;
17
17
#if LIBCURL_VERSION_NUM >= 0x070902
18
- static const char * ssl_key = NULL ;
18
+ static const char * ssl_key ;
19
19
#endif
20
20
#if LIBCURL_VERSION_NUM >= 0x070908
21
- static const char * ssl_capath = NULL ;
21
+ static const char * ssl_capath ;
22
22
#endif
23
- static const char * ssl_cainfo = NULL ;
23
+ static const char * ssl_cainfo ;
24
24
static long curl_low_speed_limit = -1 ;
25
25
static long curl_low_speed_time = -1 ;
26
- static int curl_ftp_no_epsv = 0 ;
27
- static const char * curl_http_proxy = NULL ;
26
+ static int curl_ftp_no_epsv ;
27
+ static const char * curl_http_proxy ;
28
28
29
29
static struct curl_slist * pragma_header ;
30
30
31
- static struct active_request_slot * active_queue_head = NULL ;
31
+ static struct active_request_slot * active_queue_head ;
32
32
33
33
size_t fread_buffer (void * ptr , size_t eltsize , size_t nmemb , void * buffer_ )
34
34
{
@@ -94,9 +94,8 @@ static void process_curl_messages(void)
94
94
static int http_options (const char * var , const char * value , void * cb )
95
95
{
96
96
if (!strcmp ("http.sslverify" , var )) {
97
- if (curl_ssl_verify == -1 ) {
97
+ if (curl_ssl_verify == -1 )
98
98
curl_ssl_verify = git_config_bool (var , value );
99
- }
100
99
return 0 ;
101
100
}
102
101
@@ -158,9 +157,9 @@ static int http_options(const char *var, const char *value, void *cb)
158
157
return git_default_config (var , value , cb );
159
158
}
160
159
161
- static CURL * get_curl_handle (void )
160
+ static CURL * get_curl_handle (void )
162
161
{
163
- CURL * result = curl_easy_init ();
162
+ CURL * result = curl_easy_init ();
164
163
165
164
if (!curl_ssl_verify ) {
166
165
curl_easy_setopt (result , CURLOPT_SSL_VERIFYPEER , 0 );
@@ -322,15 +321,14 @@ struct active_request_slot *get_active_slot(void)
322
321
/* Wait for a slot to open up if the queue is full */
323
322
while (active_requests >= max_requests ) {
324
323
curl_multi_perform (curlm , & num_transfers );
325
- if (num_transfers < active_requests ) {
324
+ if (num_transfers < active_requests )
326
325
process_curl_messages ();
327
- }
328
326
}
329
327
#endif
330
328
331
- while (slot != NULL && slot -> in_use ) {
329
+ while (slot != NULL && slot -> in_use )
332
330
slot = slot -> next ;
333
- }
331
+
334
332
if (slot == NULL ) {
335
333
newslot = xmalloc (sizeof (* newslot ));
336
334
newslot -> curl = NULL ;
@@ -341,9 +339,8 @@ struct active_request_slot *get_active_slot(void)
341
339
if (slot == NULL ) {
342
340
active_queue_head = newslot ;
343
341
} else {
344
- while (slot -> next != NULL ) {
342
+ while (slot -> next != NULL )
345
343
slot = slot -> next ;
346
- }
347
344
slot -> next = newslot ;
348
345
}
349
346
slot = newslot ;
@@ -404,7 +401,7 @@ struct fill_chain {
404
401
struct fill_chain * next ;
405
402
};
406
403
407
- static struct fill_chain * fill_cfg = NULL ;
404
+ static struct fill_chain * fill_cfg ;
408
405
409
406
void add_fill_function (void * data , int (* fill )(void * ))
410
407
{
@@ -535,9 +532,8 @@ static void finish_active_slot(struct active_request_slot *slot)
535
532
}
536
533
537
534
/* Run callback if appropriate */
538
- if (slot -> callback_func != NULL ) {
535
+ if (slot -> callback_func != NULL )
539
536
slot -> callback_func (slot -> callback_data );
540
- }
541
537
}
542
538
543
539
void finish_all_active_slots (void )
@@ -567,8 +563,10 @@ static inline int needs_quote(int ch)
567
563
568
564
static inline int hex (int v )
569
565
{
570
- if (v < 10 ) return '0' + v ;
571
- else return 'A' + v - 10 ;
566
+ if (v < 10 )
567
+ return '0' + v ;
568
+ else
569
+ return 'A' + v - 10 ;
572
570
}
573
571
574
572
static char * quote_ref_url (const char * base , const char * ref )
0 commit comments