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

@@ -58,6 +58,14 @@ bool isAlphanumeric(int c) {
return isLetter(c) || isDigit(c);
}
char toLower(char c) {
return isUpper(c) ? c - 'A' + 'a' : c;
}
char toUpper(char c) {
return isLower(c) ? c - 'a' + 'A' : c;
}
bool startsIdentifier(int c) {
// This returns false for anonymous labels, which internally start with a '!',
// and for section fragment literal labels, which internally start with a '$'.