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

Re: [PATCH] parse-options: fix sparse 'plain integer as NULL pointer'

From
JSJiamu Sun <39@barroit.sh>
Date
Apr 29, 2026, 05:13 UTC
Message-ID
<SY0P300MB0801A25D4414FCB5C522E407CE342@SY0P300MB0801.AUSP300.PROD.OUTLOOK.COM>
In-Reply-To
<d0357af8-ce70-77be-a885-070420d76c0b@gmx.de>
On Sun, Apr 26, 2026 at 02:14:03PM +0200, Johannes Schindelin wrote:
Show 44 quoted lines
> Indeed. With this patch on top of Ramsay's fixup, it passes the build:
> 
> Assisted-by: Claude Opus 4.6
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>  parse-options.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/parse-options.c b/parse-options.c
> index 14f3f385eb4..0ba6905fed5 100644
> --- a/parse-options.c
> +++ b/parse-options.c
> @@ -648,7 +648,8 @@ static const char *autocorrect_subcommand(const char *cmd,
>  					  struct string_list *cmds)
>  {
>  	struct autocorrect autocorrect = { 0 };
> -	unsigned int n = 0, best = 0;
> +	unsigned int n = 0;
> +	intptr_t best = 0;
>  	struct string_list_item *cand;
>  
>  	autocorrect_resolve(&autocorrect);
> -- snap --
> 
> > > Ramsay Jones
> > >
> > >  parse-options.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/parse-options.c b/parse-options.c
> > > index d60e7bd3c9..14f3f385eb 100644
> > > --- a/parse-options.c
> > > +++ b/parse-options.c
> > > @@ -658,7 +658,7 @@ static const char *autocorrect_subcommand(const char *cmd,
> > >
> > >         for_each_string_list_item(cand, cmds) {
> > >                 if (starts_with(cand->string, cmd)) {
> > > -                       cand->util = 0;
> > > +                       cand->util = NULL;
> > >                 } else {
> > >                         int edit = levenshtein(cmd, cand->string,
> > >                                                0, 2, 1, 3) + 1;
> > > --
> > > 2.54.0
Will squash these in next re-roll.
Thanks everyone for catching these issues and providing the fixups.
-- 
Jiamu Sun <39@barroit.sh>
          <sunjiamu@outlook.com>
Previous: Johannes Schindelin
Message 4 of 4 in “parse-options: fix sparse 'plain integer as NULL pointer'”
  1. parse-options: fix sparse 'plain integer as NULL pointer'Ramsay Jones, Apr 23, 2026
  2. Junio C HamanoApr 24, 2026
  3. Johannes SchindelinApr 26, 2026
  4. Jiamu SunApr 29, 2026

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.