On Sat, Nov 16, 2024 at 09:35:01PM +0000, Gavin Smith wrote:
> I don't remember for certain but we already cast to unsigned char
> in the call to isspace in xspara.c.
> 
> 2022-04-14  Gavin Smith  <gavinsmith0...@gmail.com>
> 
>         unsigned char for isspace
> 
>         * tp/Texinfo/XS/parsetexi/end_line.c (end_line_misc_line),
>         * tp/Texinfo/XS/xspara.c (xspara_add_text):
>         Cast argument to isspace to unsigned char.  This avoids varying
>         test results on Solaris 10 and 11.
> 
> The Linux man pages state ("man isalpha"):
> 
>       The standards require that the argument c for these functions is either
>        EOF or a value that is representable in the type unsigned char.  If the
>        argument c is of type char, it must be cast to unsigned char, as in the
>        following example:
> 
>            char c;
>            ...
>            res = toupper((unsigned char) c);
> 
>        This is necessary because char may be the equivalent of signed char, in
>        which case a byte where the top bit is set would be sign extended  when
>        converting  to  int,  yielding a value that is outside the range of un‐
>        signed char.
> 
> It may not matter much in practice but I expect that it would be ok to
> put the casts in.

Ok, I can do that.

-- 
Pat

Reply via email to