Replace all ctype.h functions with locale-independent ones

This commit is contained in:
Rangi
2025-10-03 12:52:24 -04:00
parent 268b586c9d
commit 13e85b5151
4 changed files with 22 additions and 12 deletions

View File

@@ -12,7 +12,7 @@
#include "helpers.hpp" // unreachable_
#include "platform.hpp" // strcasecmp
#include "util.hpp" // isBlankSpace, isLower, isDigit
#include "util.hpp"
#include "fix/warning.hpp"
@@ -103,12 +103,10 @@ static void skipMBCSpace(char const *&ptr) {
}
static char normalizeMBCChar(char c) {
if (isLower(c)) {
c = c - 'a' + 'A'; // Uppercase for comparison with `mbc_Name`s
} else if (c == '_') {
c = ' '; // Treat underscores as spaces
if (c == '_') {
return ' '; // Treat underscores as spaces
}
return c;
return toUpper(c); // Uppercase for comparison with `mbc_Name`s
}
[[noreturn]]