Skip to content

Commit 4251ccb

Browse files
committed
http.c: style cleanups
Signed-off-by: Junio C Hamano <[email protected]>
1 parent c4994ce commit 4251ccb

File tree

1 file changed

+21
-23
lines changed

1 file changed

+21
-23
lines changed

http.c

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "http.h"
22

33
int data_received;
4-
int active_requests = 0;
4+
int active_requests;
55

66
#ifdef USE_CURL_MULTI
77
static int max_requests = -1;
@@ -13,22 +13,22 @@ static CURL *curl_default;
1313
char curl_errorstr[CURL_ERROR_SIZE];
1414

1515
static int curl_ssl_verify = -1;
16-
static const char *ssl_cert = NULL;
16+
static const char *ssl_cert;
1717
#if LIBCURL_VERSION_NUM >= 0x070902
18-
static const char *ssl_key = NULL;
18+
static const char *ssl_key;
1919
#endif
2020
#if LIBCURL_VERSION_NUM >= 0x070908
21-
static const char *ssl_capath = NULL;
21+
static const char *ssl_capath;
2222
#endif
23-
static const char *ssl_cainfo = NULL;
23+
static const char *ssl_cainfo;
2424
static long curl_low_speed_limit = -1;
2525
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;
2828

2929
static struct curl_slist *pragma_header;
3030

31-
static struct active_request_slot *active_queue_head = NULL;
31+
static struct active_request_slot *active_queue_head;
3232

3333
size_t fread_buffer(void *ptr, size_t eltsize, size_t nmemb, void *buffer_)
3434
{
@@ -94,9 +94,8 @@ static void process_curl_messages(void)
9494
static int http_options(const char *var, const char *value, void *cb)
9595
{
9696
if (!strcmp("http.sslverify", var)) {
97-
if (curl_ssl_verify == -1) {
97+
if (curl_ssl_verify == -1)
9898
curl_ssl_verify = git_config_bool(var, value);
99-
}
10099
return 0;
101100
}
102101

@@ -158,9 +157,9 @@ static int http_options(const char *var, const char *value, void *cb)
158157
return git_default_config(var, value, cb);
159158
}
160159

161-
static CURL* get_curl_handle(void)
160+
static CURL *get_curl_handle(void)
162161
{
163-
CURL* result = curl_easy_init();
162+
CURL *result = curl_easy_init();
164163

165164
if (!curl_ssl_verify) {
166165
curl_easy_setopt(result, CURLOPT_SSL_VERIFYPEER, 0);
@@ -322,15 +321,14 @@ struct active_request_slot *get_active_slot(void)
322321
/* Wait for a slot to open up if the queue is full */
323322
while (active_requests >= max_requests) {
324323
curl_multi_perform(curlm, &num_transfers);
325-
if (num_transfers < active_requests) {
324+
if (num_transfers < active_requests)
326325
process_curl_messages();
327-
}
328326
}
329327
#endif
330328

331-
while (slot != NULL && slot->in_use) {
329+
while (slot != NULL && slot->in_use)
332330
slot = slot->next;
333-
}
331+
334332
if (slot == NULL) {
335333
newslot = xmalloc(sizeof(*newslot));
336334
newslot->curl = NULL;
@@ -341,9 +339,8 @@ struct active_request_slot *get_active_slot(void)
341339
if (slot == NULL) {
342340
active_queue_head = newslot;
343341
} else {
344-
while (slot->next != NULL) {
342+
while (slot->next != NULL)
345343
slot = slot->next;
346-
}
347344
slot->next = newslot;
348345
}
349346
slot = newslot;
@@ -404,7 +401,7 @@ struct fill_chain {
404401
struct fill_chain *next;
405402
};
406403

407-
static struct fill_chain *fill_cfg = NULL;
404+
static struct fill_chain *fill_cfg;
408405

409406
void add_fill_function(void *data, int (*fill)(void *))
410407
{
@@ -535,9 +532,8 @@ static void finish_active_slot(struct active_request_slot *slot)
535532
}
536533

537534
/* Run callback if appropriate */
538-
if (slot->callback_func != NULL) {
535+
if (slot->callback_func != NULL)
539536
slot->callback_func(slot->callback_data);
540-
}
541537
}
542538

543539
void finish_all_active_slots(void)
@@ -567,8 +563,10 @@ static inline int needs_quote(int ch)
567563

568564
static inline int hex(int v)
569565
{
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;
572570
}
573571

574572
static char *quote_ref_url(const char *base, const char *ref)

0 commit comments

Comments
 (0)