git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Peter Hagervall <hager@cs.umu.se>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Sparse fixes for http-fetch
Date: Thu, 13 Oct 2005 11:16:34 -0700	[thread overview]
Message-ID: <7vd5m92sfx.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <20051013174203.GA6860@peppar.cs.umu.se> (Peter Hagervall's message of "Thu, 13 Oct 2005 19:42:03 +0200")

Peter Hagervall <hager@cs.umu.se> writes:

> 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?

How about something like this on top of what you posted?  There
still is one in main(), but... 

---
cd /opt/packrat/playpen/public/in-place/git/git.junio/
git diff
diff --git a/http-fetch.c b/http-fetch.c
index 26f8130..d549471 100644
--- a/http-fetch.c
+++ b/http-fetch.c
@@ -27,6 +27,8 @@ static int data_received;
 #ifdef USE_CURL_MULTI
 static int max_requests = DEFAULT_MAX_REQUESTS;
 static CURLM *curlm;
+static void process_curl_messages();
+static void process_request_queue();
 #endif
 static CURL *curl_default;
 static struct curl_slist *pragma_header;
@@ -154,11 +156,6 @@ static size_t fwrite_sha1_file(void *ptr
 	return size;
 }
 
-#ifdef USE_CURL_MULTI
-void process_curl_messages();
-void process_request_queue();
-#endif
-
 static struct active_request_slot *get_active_slot(void)
 {
 	struct active_request_slot *slot = active_queue_head;
@@ -443,7 +440,7 @@ static void release_request(struct trans
 }
 
 #ifdef USE_CURL_MULTI
-void process_curl_messages(void)
+static void process_curl_messages(void)
 {
 	int num_messages;
 	struct active_request_slot *slot;
@@ -495,7 +492,7 @@ void process_curl_messages(void)
 	}
 }
 
-void process_request_queue(void)
+static void process_request_queue(void)
 {
 	struct transfer_request *request = request_queue_head;
 	int num_transfers;
@@ -904,9 +901,6 @@ 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;
@@ -920,6 +914,7 @@ static int fetch_object(struct alt_base 
 
 #ifdef USE_CURL_MULTI
 	while (request->state == WAITING) {
+		int num_transfers;
 		curl_multi_perform(curlm, &num_transfers);
 		if (num_transfers < active_requests) {
 			process_curl_messages();

Compilation finished at Thu Oct 13 11:14:23

      parent reply	other threads:[~2005-10-13 18:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-13 17:42 [PATCH] Sparse fixes for http-fetch Peter Hagervall
2005-10-13 17:51 ` H. Peter Anvin
2005-10-13 18:16 ` Junio C Hamano [this message]

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=7vd5m92sfx.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=git@vger.kernel.org \
    --cc=hager@cs.umu.se \
    /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;
as well as URLs for NNTP newsgroup(s).