Subject: Re: [PATCH] global: constify some pointers that are not written to

From: Jeff King <[email-masked]>
Date: Thu, 5 Feb 2026 02:41:39 -0500

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