Using 'l_uint32' for unicode codepoints in scanner

'l_uint32' is enough for unicode codepoints (versus unsigned long),
and the utf-8 library already uses that type.
This commit is contained in:
Roberto Ierusalimschy
2025-05-08 12:49:39 -03:00
parent 3f0ea90aa8
commit d827e96f33
4 changed files with 7 additions and 7 deletions

6
llex.c
View File

@@ -359,12 +359,12 @@ static int readhexaesc (LexState *ls) {
** for error reporting in case of errors; 'i' counts the number of
** saved characters, so that they can be removed if case of success.
*/
static unsigned long readutf8esc (LexState *ls) {
unsigned long r;
static l_uint32 readutf8esc (LexState *ls) {
l_uint32 r;
int i = 4; /* number of chars to be removed: start with #"\u{X" */
save_and_next(ls); /* skip 'u' */
esccheck(ls, ls->current == '{', "missing '{'");
r = cast_ulong(gethexa(ls)); /* must have at least one digit */
r = cast_uint(gethexa(ls)); /* must have at least one digit */
while (cast_void(save_and_next(ls)), lisxdigit(ls->current)) {
i++;
esccheck(ls, r <= (0x7FFFFFFFu >> 4), "UTF-8 value too large");