[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GNU poke 2.0.91 pre-released in alpha.gnu.org

From: Bruno Haible
Subject: Re: GNU poke 2.0.91 pre-released in alpha.gnu.org
Date: Sat, 05 Feb 2022 09:28:17 +0100

Jose E. Marchesi wrote:
> > regexec takes nmatch, pmatch arguments. If nmatch is 1, pmatch must be an
> > array of length 1, not NULL.
> regex(3) says:
>        REG_NOSUB
>               Do  not report position of matches.  The nmatch and pmatch argu‐
>               ments to regexec() are ignored if the  pattern  buffer  supplied
>               was compiled with this flag set.
> In this case we used REG_NOSUB to compile the pattern buffer.

Indeed, POSIX 
too says:
       If nmatch is 0 or REG_NOSUB was set in the cflags argument to regcomp(),
       then regexec() shall ignore the pmatch argument.

So, the combination of glibc headers and GCC causes a false warning. But I
guess that it will stay, because for the other cases (without REG_NOSUB) it
is a useful warning.

> I committed the patch below anyway.

Should work; thanks. Another possibility would have been to pass nmatch = 0
instead of nmatch = 1.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]