All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "René Scharfe" <l.s.r@web.de>
Cc: Git List <git@vger.kernel.org>
Subject: Re: [PATCH] object-name: declare pointer type of extend_abbrev_len()'s 2nd parameter
Date: Thu, 04 Sep 2025 13:09:18 -0700	[thread overview]
Message-ID: <xmqqv7ly6kup.fsf@gitster.g> (raw)
In-Reply-To: <e0bc9a67-faa9-4218-a55a-c7d53c15cfce@web.de> ("René Scharfe"'s message of "Thu, 4 Sep 2025 19:58:25 +0200")

René Scharfe <l.s.r@web.de> writes:

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




  reply	other threads:[~2025-09-04 20:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-04 17:58 [PATCH] object-name: declare pointer type of extend_abbrev_len()'s 2nd parameter René Scharfe
2025-09-04 20:09 ` Junio C Hamano [this message]
2025-09-07 16:22   ` René Scharfe
2025-09-08  4:17     ` Junio C Hamano

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=xmqqv7ly6kup.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=l.s.r@web.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.