http.c: style cleanups
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Mar 9, 2009 at 18:47 UTC
4251ccbd80eff92270503a48d35385516c3d106d
1 file changed
+21
-23
http.c
+21
-23
@@ -1,7 +1,7 @@
1
#include "http.h"
2
3
int data_received;
4
-int active_requests = 0;
4
+int active_requests;
5
6
#ifdef USE_CURL_MULTI
7
static int max_requests = -1;
@@ -13,22 +13,22 @@ static CURL *curl_default;
13
char curl_errorstr[CURL_ERROR_SIZE];
14
15
static int curl_ssl_verify = -1;
16
-static const char *ssl_cert = NULL;
16
+static const char *ssl_cert;
17
#if LIBCURL_VERSION_NUM >= 0x070902
18
-static const char *ssl_key = NULL;
18
+static const char *ssl_key;
19
#endif
20
#if LIBCURL_VERSION_NUM >= 0x070908
21
-static const char *ssl_capath = NULL;
21
+static const char *ssl_capath;
22
#endif
23
-static const char *ssl_cainfo = NULL;
23
+static const char *ssl_cainfo;
24
static long curl_low_speed_limit = -1;
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
29
static struct curl_slist *pragma_header;
30
31
-static struct active_request_slot *active_queue_head = NULL;
31
+static struct active_request_slot *active_queue_head;
32
33
size_t fread_buffer(void *ptr, size_t eltsize, size_t nmemb, void *buffer_)
34
{
@@ -94,9 +94,8 @@ static void process_curl_messages(void)
94
static int http_options(const char *var, const char *value, void *cb)
95
{
96
if (!strcmp("http.sslverify", var)) {
97
- if (curl_ssl_verify == -1) {
97
+ if (curl_ssl_verify == -1)
98
curl_ssl_verify = git_config_bool(var, value);
99
- }
99
return 0;
100
}
101
@@ -158,9 +157,9 @@ static int http_options(const char *var, const char *value, void *cb)
157
return git_default_config(var, value, cb);
158
}
159
161
-static CURL* get_curl_handle(void)
160
+static CURL *get_curl_handle(void)
161
{
163
- CURL* result = curl_easy_init();
162
+ CURL *result = curl_easy_init();
163
164
if (!curl_ssl_verify) {
165
curl_easy_setopt(result, CURLOPT_SSL_VERIFYPEER, 0);
@@ -322,15 +321,14 @@ struct active_request_slot *get_active_slot(void)
321
/* Wait for a slot to open up if the queue is full */
322
while (active_requests >= max_requests) {
323
curl_multi_perform(curlm, &num_transfers);
325
- if (num_transfers < active_requests) {
324
+ if (num_transfers < active_requests)
325
process_curl_messages();
327
- }
326
}
327
#endif
328
331
- while (slot != NULL && slot->in_use) {
329
+ while (slot != NULL && slot->in_use)
330
slot = slot->next;
333
- }
331
+
332
if (slot == NULL) {
333
newslot = xmalloc(sizeof(*newslot));
334
newslot->curl = NULL;
@@ -341,9 +339,8 @@ struct active_request_slot *get_active_slot(void)
339
if (slot == NULL) {
340
active_queue_head = newslot;
341
} else {
344
- while (slot->next != NULL) {
342
+ while (slot->next != NULL)
343
slot = slot->next;
346
- }
344
slot->next = newslot;
345
}
346
slot = newslot;
@@ -404,7 +401,7 @@ struct fill_chain {
401
struct fill_chain *next;
402
};
403
407
-static struct fill_chain *fill_cfg = NULL;
404
+static struct fill_chain *fill_cfg;
405
406
void add_fill_function(void *data, int (*fill)(void *))
407
{
@@ -535,9 +532,8 @@ static void finish_active_slot(struct active_request_slot *slot)
532
}
533
534
/* Run callback if appropriate */
538
- if (slot->callback_func != NULL) {
535
+ if (slot->callback_func != NULL)
536
slot->callback_func(slot->callback_data);
540
- }
537
}
538
539
void finish_all_active_slots(void)
@@ -567,8 +563,10 @@ static inline int needs_quote(int ch)
563
564
static inline int hex(int v)
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;
570
}
571
572
static char *quote_ref_url(const char *base, const char *ref)