From: Peter Hagervall <hager@cs.umu.se>
To: junkio@cox.net
Cc: git@vger.kernel.org
Subject: [PATCH] Sparse fixes for http-fetch
Date: Thu, 13 Oct 2005 19:42:03 +0200 [thread overview]
Message-ID: <20051013174203.GA6860@peppar.cs.umu.se> (raw)
This patch cleans out all sparse warnings from http-fetch.c
I'm a bit uncomfortable with adding extra #ifdefs to avoid either
'mixing declaration with code' or 'unused variable' warnings, but I
figured that since those functions are already littered with #ifdefs I
might just get away with it. Comments?
---
* ANSI:fy a few function definitions
* Make needlessly global functions static
* Move variable declarations to beginning of enclosing block
Signed-off-by: Peter Hagervall <hager@cs.umu.se>
---
diff --git a/http-fetch.c b/http-fetch.c
index 0aba891..f2d0e0a 100644
--- a/http-fetch.c
+++ b/http-fetch.c
@@ -143,7 +143,7 @@ void process_curl_messages();
void process_request_queue();
#endif
-struct active_request_slot *get_active_slot()
+static struct active_request_slot *get_active_slot(void)
{
struct active_request_slot *slot = active_queue_head;
struct active_request_slot *newslot;
@@ -192,7 +192,7 @@ struct active_request_slot *get_active_s
return slot;
}
-int start_active_slot(struct active_request_slot *slot)
+static int start_active_slot(struct active_request_slot *slot)
{
#ifdef USE_CURL_MULTI
CURLMcode curlm_result = curl_multi_add_handle(curlm, slot->curl);
@@ -207,7 +207,7 @@ int start_active_slot(struct active_requ
return 1;
}
-void run_active_slot(struct active_request_slot *slot)
+static void run_active_slot(struct active_request_slot *slot)
{
#ifdef USE_CURL_MULTI
int num_transfers;
@@ -255,7 +255,7 @@ void run_active_slot(struct active_reque
#endif
}
-void start_request(struct transfer_request *request)
+static void start_request(struct transfer_request *request)
{
char *hex = sha1_to_hex(request->sha1);
char prevfile[PATH_MAX];
@@ -381,7 +381,7 @@ void start_request(struct transfer_reque
request->state = ACTIVE;
}
-void finish_request(struct transfer_request *request)
+static void finish_request(struct transfer_request *request)
{
fchmod(request->local, 0444);
close(request->local);
@@ -409,7 +409,7 @@ void finish_request(struct transfer_requ
pull_say("got %s\n", sha1_to_hex(request->sha1));
}
-void release_request(struct transfer_request *request)
+static void release_request(struct transfer_request *request)
{
struct transfer_request *entry = request_queue_head;
@@ -427,7 +427,7 @@ void release_request(struct transfer_req
}
#ifdef USE_CURL_MULTI
-void process_curl_messages()
+void process_curl_messages(void)
{
int num_messages;
struct active_request_slot *slot;
@@ -479,7 +479,7 @@ void process_curl_messages()
}
}
-void process_request_queue()
+void process_request_queue(void)
{
struct transfer_request *request = request_queue_head;
int num_transfers;
@@ -875,6 +875,9 @@ static int fetch_object(struct alt_base
char *hex = sha1_to_hex(sha1);
int ret;
struct transfer_request *request = request_queue_head;
+#ifdef USE_CURL_MULTI
+ int num_transfers;
+#endif
while (request != NULL && memcmp(request->sha1, sha1, 20))
request = request->next;
@@ -887,7 +890,6 @@ static int fetch_object(struct alt_base
}
#ifdef USE_CURL_MULTI
- int num_transfers;
while (request->state == WAITING) {
curl_multi_perform(curlm, &num_transfers);
if (num_transfers < active_requests) {
@@ -1052,6 +1054,9 @@ int main(int argc, char **argv)
char *url;
int arg = 1;
struct active_request_slot *slot;
+#ifdef USE_CURL_MULTI
+ char *http_max_requests;
+#endif
while (arg < argc && argv[arg][0] == '-') {
if (argv[arg][1] == 't') {
@@ -1082,7 +1087,7 @@ int main(int argc, char **argv)
curl_global_init(CURL_GLOBAL_ALL);
#ifdef USE_CURL_MULTI
- char *http_max_requests = getenv("GIT_HTTP_MAX_REQUESTS");
+ http_max_requests = getenv("GIT_HTTP_MAX_REQUESTS");
if (http_max_requests != NULL)
max_requests = atoi(http_max_requests);
if (max_requests < 1)
next reply other threads:[~2005-10-13 17:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-13 17:42 Peter Hagervall [this message]
2005-10-13 17:51 ` [PATCH] Sparse fixes for http-fetch H. Peter Anvin
2005-10-13 18:16 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20051013174203.GA6860@peppar.cs.umu.se \
--to=hager@cs.umu.se \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox