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

Re: [PATCH] object-name: declare pointer type of extend_abbrev_len()'s 2nd parameter

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 4, 2025, 20:09 UTC
Message-ID
<xmqqv7ly6kup.fsf@gitster.g>
In-Reply-To
<e0bc9a67-faa9-4218-a55a-c7d53c15cfce@web.de>
René Scharfe <l.s.r@web.de> writes:
Show 9 quoted lines
> Expose the expected type of the second parameter of extend_abbrev_len()
> instead of casting a void pointer internally.  Just a single caller
> passes in a void pointer, the rest pass the correct type.  Let the
> compiler help keeping it that way.
>
> Signed-off-by: René Scharfe <l.s.r@web.de>
> ---
>  object-name.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)

We obviously do *not* have to, but I have to wonder if we want to go one step further to have that single caller explicitly cast it down to make the intent more clear, i.e.e.g.,

 object-name.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git c/object-name.c w/object-name.c
index 11aa0e6afc..8335d0239e 100644
--- c/object-name.c
+++ w/object-name.c
@@ -714,7 +714,9 @@ static int repo_extend_abbrev_len(struct repository *r UNUSED,
 				  const struct object_id *oid,
 				  void *cb_data)
 {
-	return extend_abbrev_len(oid, cb_data);
+	struct min_abbrev_data *mad = cb_data;
+
+	return extend_abbrev_len(oid, mad);
 }
 
 static void find_abbrev_len_for_midx(struct multi_pack_index *m,
Previous: René ScharfeNext: René Scharfe
Message 2 of 4 in “object-name: declare pointer type of extend_abbrev_len()'s 2nd parameter”
  1. object-name: declare pointer type of extend_abbrev_len()'s 2nd parameterRené Scharfe, Sep 4, 2025
  2. Junio C HamanoSep 4, 2025
  3. René ScharfeSep 7, 2025
  4. Junio C HamanoSep 8, 2025

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.