{"thread":{"id":"18243","subject":"[RFH/Patch 1/2] http.c: style cleanups","startedAt":"2009-03-10T02:19:40Z","lastAt":"2009-03-10T02:19:40Z","messageCount":1,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"107536","messageId":"7vljrece6b.fsf@gitster.siamese.dyndns.org","threadId":"18243","inReplyTo":null,"subject":"[RFH/Patch 1/2] http.c: style cleanups","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-03-10T02:19:40Z","receivedAt":"2009-03-10T02:19:40Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"The file is littered with coding style violations; this cleans-up before I\ntouch it with the next patch.\n\n - We do not initialize statics to NULL/0; we let BSS take care of it\n   instead.\n\n - Asterisk that means a pointerness comes next to variable, not type;\n   i.e. a decl looks like \"type *variable\", not \"type* variable\".\n\n - A single-statement in true/false clause of an \"if () ... else ...;\"\n   statement comes on its own line, without curlies {} around it.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n\n * This is not what I am asking for help by sending the series, but the\n   next one is.\n\n http.c |   44 +++++++++++++++++++++-----------------------\n 1 files changed, 21 insertions(+), 23 deletions(-)\n\ndiff --git a/http.c b/http.c\nindex 56f18f1..d1ead66 100644\n--- a/http.c\n+++ b/http.c\n@@ -1,7 +1,7 @@\n #include \"http.h\"\n \n int data_received;\n-int active_requests = 0;\n+int active_requests;\n \n #ifdef USE_CURL_MULTI\n static int max_requests = -1;\n@@ -13,22 +13,22 @@ static CURL *curl_default;\n char curl_errorstr[CURL_ERROR_SIZE];\n \n static int curl_ssl_verify = -1;\n-static const char *ssl_cert = NULL;\n+static const char *ssl_cert;\n #if LIBCURL_VERSION_NUM >= 0x070902\n-static const char *ssl_key = NULL;\n+static const char *ssl_key;\n #endif\n #if LIBCURL_VERSION_NUM >= 0x070908\n-static const char *ssl_capath = NULL;\n+static const char *ssl_capath;\n #endif\n-static const char *ssl_cainfo = NULL;\n+static const char *ssl_cainfo;\n static long curl_low_speed_limit = -1;\n static long curl_low_speed_time = -1;\n-static int curl_ftp_no_epsv = 0;\n-static const char *curl_http_proxy = NULL;\n+static int curl_ftp_no_epsv;\n+static const char *curl_http_proxy;\n \n static struct curl_slist *pragma_header;\n \n-static struct active_request_slot *active_queue_head = NULL;\n+static struct active_request_slot *active_queue_head;\n \n size_t fread_buffer(void *ptr, size_t eltsize, size_t nmemb, void *buffer_)\n {\n@@ -94,9 +94,8 @@ static void process_curl_messages(void)\n static int http_options(const char *var, const char *value, void *cb)\n {\n \tif (!strcmp(\"http.sslverify\", var)) {\n-\t\tif (curl_ssl_verify == -1) {\n+\t\tif (curl_ssl_verify == -1)\n \t\t\tcurl_ssl_verify = git_config_bool(var, value);\n-\t\t}\n \t\treturn 0;\n \t}\n \n@@ -158,9 +157,9 @@ static int http_options(const char *var, const char *value, void *cb)\n \treturn git_default_config(var, value, cb);\n }\n \n-static CURL* get_curl_handle(void)\n+static CURL *get_curl_handle(void)\n {\n-\tCURL* result = curl_easy_init();\n+\tCURL *result = curl_easy_init();\n \n \tif (!curl_ssl_verify) {\n \t\tcurl_easy_setopt(result, CURLOPT_SSL_VERIFYPEER, 0);\n@@ -322,15 +321,14 @@ struct active_request_slot *get_active_slot(void)\n \t/* Wait for a slot to open up if the queue is full */\n \twhile (active_requests >= max_requests) {\n \t\tcurl_multi_perform(curlm, &num_transfers);\n-\t\tif (num_transfers < active_requests) {\n+\t\tif (num_transfers < active_requests)\n \t\t\tprocess_curl_messages();\n-\t\t}\n \t}\n #endif\n \n-\twhile (slot != NULL && slot->in_use) {\n+\twhile (slot != NULL && slot->in_use)\n \t\tslot = slot->next;\n-\t}\n+\n \tif (slot == NULL) {\n \t\tnewslot = xmalloc(sizeof(*newslot));\n \t\tnewslot->curl = NULL;\n@@ -341,9 +339,8 @@ struct active_request_slot *get_active_slot(void)\n \t\tif (slot == NULL) {\n \t\t\tactive_queue_head = newslot;\n \t\t} else {\n-\t\t\twhile (slot->next != NULL) {\n+\t\t\twhile (slot->next != NULL)\n \t\t\t\tslot = slot->next;\n-\t\t\t}\n \t\t\tslot->next = newslot;\n \t\t}\n \t\tslot = newslot;\n@@ -404,7 +401,7 @@ struct fill_chain {\n \tstruct fill_chain *next;\n };\n \n-static struct fill_chain *fill_cfg = NULL;\n+static struct fill_chain *fill_cfg;\n \n void add_fill_function(void *data, int (*fill)(void *))\n {\n@@ -535,9 +532,8 @@ static void finish_active_slot(struct active_request_slot *slot)\n \t}\n \n \t/* Run callback if appropriate */\n-\tif (slot->callback_func != NULL) {\n+\tif (slot->callback_func != NULL)\n \t\tslot->callback_func(slot->callback_data);\n-\t}\n }\n \n void finish_all_active_slots(void)\n@@ -567,8 +563,10 @@ static inline int needs_quote(int ch)\n \n static inline int hex(int v)\n {\n-\tif (v < 10) return '0' + v;\n-\telse return 'A' + v - 10;\n+\tif (v < 10)\n+\t\treturn '0' + v;\n+\telse\n+\t\treturn 'A' + v - 10;\n }\n \n static char *quote_ref_url(const char *base, const char *ref)\n-- \n1.6.2.206.g5bda76\n"}]}