Subject: Re: bug#60708: pcre: improve support for linking with a library without unicode

From: Paul Eggert <[email-masked]>
Date: Wed, 11 Jan 2023 13:13:19 -0800

On 2023-01-10 21:37, Jim Meyering wrote:

> +  uint32_t unicode = 1;
> +  pcre2_config (PCRE2_CONFIG_UNICODE, &unicode);
> +  if (unicode && localeinfo.multibyte)

Shouldn't that be:

   uint32_t unicode;
   if (localeinfo.multibyte
       && 0 <= pcre2_config (PCRE2_CONFIG_UNICODE, &unicode)
       && unicode)

That is, don't bother to call pcre2_config in a unibyte locale, and 
don't initialize 'unicode' (so that valgrind-like tools can detect an 
error if pcre2_config is buggy), and check the return value of pcre2_config.