git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/5] Avoid redundant declaration of missing_target()

From
Mike Hommey <mh@glandium.org>
Date
Dec 10, 2007, 21:36 UTC
Message-ID
<1197322571-25023-3-git-send-email-mh@glandium.org>
In-Reply-To
<1197322571-25023-2-git-send-email-mh@glandium.org>
Signed-off-by: Mike Hommey <mh@glandium.org>
---
I though it's also small enough to grant inlining.
 http-walker.c |   13 -------------
 http.h        |   13 +++++++++++++
 transport.c   |   13 -------------
 3 files changed, 13 insertions(+), 26 deletions(-)
diff --git a/http-walker.c b/http-walker.c
index d9a5f1e..8dbf9cc 100644
--- a/http-walker.c
+++ b/http-walker.c
@@ -90,19 +90,6 @@ static size_t fwrite_sha1_file(void *ptr, size_t eltsize, size_t nmemb,
 	return size;
 }
 
-static int missing__target(int code, int result)
-{
-	return	/* file:// URL -- do we ever use one??? */
-		(result == CURLE_FILE_COULDNT_READ_FILE) ||
-		/* http:// and https:// URL */
-		(code == 404 && result == CURLE_HTTP_RETURNED_ERROR) ||
-		/* ftp:// URL */
-		(code == 550 && result == CURLE_FTP_COULDNT_RETR_FILE)
-		;
-}
-
-#define missing_target(a) missing__target((a)->http_code, (a)->curl_result)
-
 static void fetch_alternates(struct walker *walker, const char *base);
 
 static void process_object_response(void *callback_data);
diff --git a/http.h b/http.h
index a0fb4cf..87d638b 100644
--- a/http.h
+++ b/http.h
@@ -83,4 +83,17 @@ extern int active_requests;
 
 extern char curl_errorstr[CURL_ERROR_SIZE];
 
+static inline int missing__target(int code, int result)
+{
+	return	/* file:// URL -- do we ever use one??? */
+		(result == CURLE_FILE_COULDNT_READ_FILE) ||
+		/* http:// and https:// URL */
+		(code == 404 && result == CURLE_HTTP_RETURNED_ERROR) ||
+		/* ftp:// URL */
+		(code == 550 && result == CURLE_FTP_COULDNT_RETR_FILE)
+		;
+}
+
+#define missing_target(a) missing__target((a)->http_code, (a)->curl_result)
+
 #endif /* HTTP_H */
diff --git a/transport.c b/transport.c
index 22234e8..4e151a9 100644
--- a/transport.c
+++ b/transport.c
@@ -426,19 +426,6 @@ static int curl_transport_push(struct transport *transport, int refspec_nr, cons
 	return !!err;
 }
 
-static int missing__target(int code, int result)
-{
-	return	/* file:// URL -- do we ever use one??? */
-		(result == CURLE_FILE_COULDNT_READ_FILE) ||
-		/* http:// and https:// URL */
-		(code == 404 && result == CURLE_HTTP_RETURNED_ERROR) ||
-		/* ftp:// URL */
-		(code == 550 && result == CURLE_FTP_COULDNT_RETR_FILE)
-		;
-}
-
-#define missing_target(a) missing__target((a)->http_code, (a)->curl_result)
-
 static struct ref *get_refs_via_curl(struct transport *transport)
 {
 	struct strbuf buffer = STRBUF_INIT;
-- 
1.5.3.7.1159.gdd4a4
Previous: Mike HommeyNext: Mike Hommey
Message 3 of 11 in “Remove the default_headers variable from http-push.c”
  1. 1/5 Remove the default_headers variable from http-push.cMike Hommey, Dec 10, 2007
  2. 2/5 Remove a CURLOPT_HTTPHEADER (un)settingMike Hommey, Dec 10, 2007
  3. 3/5 Avoid redundant declaration of missing_target()Mike Hommey, Dec 10, 2007
  4. 4/5 Correctly initialize buffer in start_put() in http-push.cMike Hommey, Dec 10, 2007
  5. 5/5 Fix various memory leaks in http-push.c and http-walker.cMike Hommey, Dec 10, 2007
  6. 6/5 Move fetch_ref from http-push.c and http-walker.c to http.cMike Hommey, Dec 10, 2007
  7. Junio C HamanoDec 11, 2007
  8. Mike HommeyDec 11, 2007
  9. Andreas EricssonDec 11, 2007
  10. Mike HommeyDec 11, 2007
  11. Move fetch_ref from http-push.c and http-walker.c to http.cMike Hommey, Dec 11, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.