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

[PATCH 2/3] show_ref(): remove unused "flag" and "cb_data" arguments

From
mhagger@alum.mit.edu <mhagger@alum.mit.edu>
Date
Jan 6, 2012, 14:12 UTC
Message-ID
<1325859153-31016-3-git-send-email-mhagger@alum.mit.edu>
In-Reply-To
<1325859153-31016-1-git-send-email-mhagger@alum.mit.edu>
From: Michael Haggerty <mhagger@alum.mit.edu>

The function is not used as a callback, so it doesn't need these arguments. Also change its return type to void.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---

I suppose, though I didn't verify, that the old function signature was a vestige of its earlier having been used as a callback function. But it doesn't really matter; the point is that the extra arguments are currently not needed.

 builtin/receive-pack.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index 08df17e..65d129c 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -115,7 +115,7 @@ static int receive_pack_config(const char *var, const char *value, void *cb)
 	return git_default_config(var, value, cb);
 }
 
-static int show_ref(const char *path, const unsigned char *sha1, int flag, void *cb_data)
+static void show_ref(const char *path, const unsigned char *sha1)
 {
 	if (sent_capabilities)
 		packet_write(1, "%s %s\n", sha1_to_hex(sha1), path);
@@ -125,10 +125,9 @@ static int show_ref(const char *path, const unsigned char *sha1, int flag, void
 			     " report-status delete-refs side-band-64k",
 			     prefer_ofs_delta ? " ofs-delta" : "");
 	sent_capabilities = 1;
-	return 0;
 }
 
-static int show_ref_cb(const char *path, const unsigned char *sha1, int flag, void *cb_data)
+static int show_ref_cb(const char *path, const unsigned char *sha1, int flag, void *unused)
 {
 	path = strip_namespace(path);
 	/*
@@ -141,7 +140,8 @@ static int show_ref_cb(const char *path, const unsigned char *sha1, int flag, vo
 	 */
 	if (!path)
 		path = ".have";
-	return show_ref(path, sha1, flag, cb_data);
+	show_ref(path, sha1);
+	return 0;
 }
 
 static void add_one_alternate_sha1(const unsigned char sha1[20], void *unused)
@@ -163,7 +163,7 @@ static void write_head_info(void)
 	sha1_array_clear(&sa);
 	for_each_ref(show_ref_cb, NULL);
 	if (!sent_capabilities)
-		show_ref("capabilities^{}", null_sha1, 0, NULL);
+		show_ref("capabilities^{}", null_sha1);
 	clear_extra_refs();
 
 	/* EOF */
-- 
1.7.8.2
Previous: mhagger@alum.mit.eduNext: Junio C Hamano
Message 3 of 7 in “Eliminate one user of extra_refs”
  1. 0/3 Eliminate one user of extra_refsmhagger@alum.mit.edu, Jan 6, 2012
  2. 1/3 receive-pack: move more work into write_head_info()mhagger@alum.mit.edu, Jan 6, 2012
  3. 2/3 show_ref(): remove unused "flag" and "cb_data" argumentsmhagger@alum.mit.edu, Jan 6, 2012
  4. Junio C HamanoJan 7, 2012
  5. 3/3 write_head_info(): handle "extra refs" locallymhagger@alum.mit.edu, Jan 6, 2012
  6. Junio C HamanoJan 6, 2012
  7. Jeff KingJan 6, 2012

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.