Fix ctype(3) function arguments.

Valid are unsigned char and EOF; add cast to make sure we're in the
allowed range.
This commit is contained in:
Thomas Klausner
2025-12-29 10:32:19 +01:00
committed by Michael Stapelberg
parent 06dfce68d9
commit 49cbf9a6d6
3 changed files with 3 additions and 3 deletions

View File

@ -732,7 +732,7 @@ static void finish(void) {
/* Skip leading whitespace */ /* Skip leading whitespace */
char *walk = line; char *walk = line;
while (isspace(*walk) && walk < (line + len)) { while (isspace((unsigned char)*walk) && walk < (line + len)) {
/* Pre-output the skipped whitespaces to keep proper indentation */ /* Pre-output the skipped whitespaces to keep proper indentation */
fputc(*walk, ks_config); fputc(*walk, ks_config);
walk++; walk++;

View File

@ -525,7 +525,7 @@ static void stdin_io_first_line_cb(int fd) {
static bool isempty(char *s) { static bool isempty(char *s) {
while (*s != '\0') { while (*s != '\0') {
if (!isspace(*s)) { if (!isspace((unsigned char)*s)) {
return false; return false;
} }
s++; s++;

View File

@ -67,7 +67,7 @@ __attribute__((__const__)) bool rect_equals(const Rect a, const Rect b) {
__attribute__((pure)) bool name_is_digits(const char *name) { __attribute__((pure)) bool name_is_digits(const char *name) {
/* positive integers and zero are interpreted as numbers */ /* positive integers and zero are interpreted as numbers */
for (size_t i = 0; i < strlen(name); i++) { for (size_t i = 0; i < strlen(name); i++) {
if (!isdigit(name[i])) { if (!isdigit((unsigned char)name[i])) {
return false; return false;
} }
} }