Cast argument to ctype functions to unsigned char
Per POSIX, "The c argument is an int, the value of which the application shall ensure is a character representable as an unsigned char or equal to the value of the macro EOF. If the argument has any other value, the behavior is undefined." https://pubs.opengroup.org/onlinepubs/009604499/functions/isspace.html Signed-off-by: Nia Alarie <nia@NetBSD.org>
This commit is contained in:
@@ -37,7 +37,7 @@ static inline int uitostr(unsigned int n, char *buf) {
|
||||
static inline const char *skip_space_const(const char *src) {
|
||||
if (!src)
|
||||
return NULL;
|
||||
while (*src && isspace(*src))
|
||||
while (*src && isspace((unsigned char)*src))
|
||||
src++;
|
||||
return src;
|
||||
}
|
||||
@@ -45,7 +45,7 @@ static inline const char *skip_space_const(const char *src) {
|
||||
static inline char *skip_space_mut(char *src) {
|
||||
if (!src)
|
||||
return NULL;
|
||||
while (*src && isspace(*src))
|
||||
while (*src && isspace((unsigned char)*src))
|
||||
src++;
|
||||
return src;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user