Fix endptr stuff in parser

This commit is contained in:
Bruce Hill 2024-03-03 17:52:22 -05:00
parent 0fe255a7c1
commit 07f0a18136
2 changed files with 3 additions and 3 deletions

View File

@ -150,12 +150,12 @@ const char *unescape(const char **out) {
*endpos = endptr;
return heap_strn((char*)buf, bufsize);
} else if (escape[1] == 'x' && escape[2] && escape[3]) {
char *endptr = (char*)&escape[3+1];
char *endptr = NULL;
char c = (char)strtol(escape+2, &endptr, 16);
*endpos = escape + 4;
return heap_strn(&c, 1);
} else if ('0' <= escape[1] && escape[1] <= '7' && '0' <= escape[2] && escape[2] <= '7' && '0' <= escape[3] && escape[3] <= '7') {
char *endptr = (char*)&escape[4];
char *endptr = NULL;
char c = (char)strtol(escape+1, &endptr, 8);
*endpos = escape + 4;
return heap_strn(&c, 1);

View File

@ -6,5 +6,5 @@
>> str:lower():title()
= "Hello Amélie!"
>> \UE9
>> \U00E9
= "é"