[ruby/json] Directly write to the output buffer when converting UTF32 to UTF8.

https://github.com/ruby/json/commit/a51317c949
This commit is contained in:
Scott Myron 2026-01-02 20:47:59 -06:00 committed by git
parent d7a6ff8224
commit b6463d59e7

View File

@ -739,9 +739,7 @@ NOINLINE(static) VALUE json_string_unescape(JSON_ParserState *state, JSON_Parser
}
}
char buf[4];
int unescape_len = convert_UTF32_to_UTF8(buf, ch);
MEMCPY(buffer, buf, char, unescape_len);
int unescape_len = convert_UTF32_to_UTF8(buffer, ch);
buffer += unescape_len;
p = ++pe;
break;