From 07f0a18136a7883d1f3edd3e08253bd3020294a8 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 3 Mar 2024 17:52:22 -0500 Subject: [PATCH] Fix endptr stuff in parser --- parse.c | 4 ++-- test/strings.tm | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/parse.c b/parse.c index b67ea41..44e3d33 100644 --- a/parse.c +++ b/parse.c @@ -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); diff --git a/test/strings.tm b/test/strings.tm index a763182..7d54b81 100644 --- a/test/strings.tm +++ b/test/strings.tm @@ -6,5 +6,5 @@ >> str:lower():title() = "Hello Amélie!" ->> \UE9 +>> \U00E9 = "é"