[Swan-commit] Changes to ref refs/heads/main
Andrew Cagney
cagney at vault.libreswan.fi
Fri Nov 27 18:25:14 UTC 2020
New commits:
commit d1ae02a014c02c098e8a600255d3fce4182545a1
Author: Andrew Cagney <cagney at gnu.org>
Date: Fri Nov 27 11:32:09 2020 -0500
code: replace <ctype.h> is*(int) with hunk.h's char_is*(char)
The is*() macros really only play well with functions such as getc()
and fget() which return integers. Libreswan's code base is instead
playing with memory octets, and the char_is*(char) functions work with
that.
From GNU/Linux manual page for is*():
The standards require that the argument c for these functions is
either EOF or a value that is representable in the type unsigned
char.
And from the NetBSD i9.0 manual page for ctype:
Some implementations of libc, such as glibc as of 2018, attempt
to avoid the worst of the undefined behavior by defining the
functions to work for all integer inputs representable by either
unsigned char or char, and suppress the warning. However, this
is not an excuse for avoiding conversion to unsigned char: if EOF
coincides with any such value, as it does when it is -1 on
platforms with signed char, programs that pass char will still
necessarily confuse the classification and mapping of EOF with
the classification and mapping of some non-EOF inputs
More information about the Swan-commit
mailing list