Meta: Manually compute the length of the WASM JS REPL source string

The REPL does not have a reliable way to tell us the UTF-8 byte count of
the source string, so we must use strlen() ourselves.
This commit is contained in:
Timothy Flynn 2022-12-06 08:33:32 -05:00 committed by Linus Groh
parent fcc3348bc8
commit d50b9165cd
Notes: sideshowbarker 2024-07-17 06:40:21 +09:00

View File

@ -386,7 +386,7 @@ extern "C" int initialize_repl(char const* time_zone)
return 0;
}
extern "C" bool execute(char const* s, u32 length)
extern "C" bool execute(char const* source)
{
return parse_and_run(*g_interpreter, { s, length }, "REPL"sv);
return parse_and_run(*g_interpreter, { source, strlen(source) }, "REPL"sv);
}