public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Collin Funk <collin.funk1@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
	Taylor Blau <me@ttaylorr.com>, Elijah Newren <newren@gmail.com>
Subject: Re: [PATCH] global: constify some pointers that are not written to
Date: Thu, 5 Feb 2026 02:41:39 -0500	[thread overview]
Message-ID: <20260205074139.GA1019015@coredump.intra.peff.net> (raw)
In-Reply-To: <342b01acd42f1fcaa3abefa38dc589e12ccb1134.1770261829.git.collin.funk1@gmail.com>

On Wed, Feb 04, 2026 at 07:24:19PM -0800, Collin Funk wrote:

> This patch fixes the more obvious ones by making them const when we do
> not write to the returned pointer.

Thanks, this looks like a good start. All of the changes look correct to
me (and can be confirmed with the compiler). I also cross-checked them
against my own earlier hacky pass. The only difference was in this hunk:

> diff --git a/gpg-interface.c b/gpg-interface.c
> index 47222bf31b..87fb6605fb 100644
> --- a/gpg-interface.c
> +++ b/gpg-interface.c
> @@ -398,7 +398,7 @@ static void parse_ssh_output(struct signature_check *sigc)
>  {
>  	const char *line, *principal, *search;
>  	char *to_free;
> -	char *key = NULL;
> +	const char *key;

You've dropped the NULL initialization here. That's OK to do, as the
NULL is never used (we assign "key" immediately before the first time we
look at it). But it probably makes sense for this patch to change only
one thing. So either leave the dead initialization, or remove it as a
separate patch.

-Peff

  reply	other threads:[~2026-02-05  7:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-05  3:24 [PATCH] global: constify some pointers that are not written to Collin Funk
2026-02-05  7:41 ` Jeff King [this message]
2026-02-05 17:49 ` Junio C Hamano
2026-02-05 22:00   ` Collin Funk
2026-02-06  1:46 ` [PATCH v2 1/2] " Collin Funk
2026-02-06  1:46   ` [PATCH v2 2/2] gpg-interface: remove an unnecessary NULL initialization Collin Funk
2026-02-06  1:59     ` Junio C Hamano
2026-02-06 15:54   ` [PATCH v2 1/2] global: constify some pointers that are not written to Ben Knoble

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=20260205074139.GA1019015@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=collin.funk1@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=me@ttaylorr.com \
    --cc=newren@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox