Re: [PATCH] Sparse fixes for http-fetch
- From
Junio C Hamano <junkio@cox.net>
- Date
- Oct 13, 2005, 18:16 UTC
- Message-ID
- <7vd5m92sfx.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <20051013174203.GA6860@peppar.cs.umu.se>
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