Skip to content

Commit b6463d5

Browse files
samyronmatzbot
authored andcommitted
[ruby/json] Directly write to the output buffer when converting UTF32 to UTF8.
ruby/json@a51317c949
1 parent d7a6ff8 commit b6463d5

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

ext/json/parser/parser.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -739,9 +739,7 @@ NOINLINE(static) VALUE json_string_unescape(JSON_ParserState *state, JSON_Parser
739739
}
740740
}
741741

742-
char buf[4];
743-
int unescape_len = convert_UTF32_to_UTF8(buf, ch);
744-
MEMCPY(buffer, buf, char, unescape_len);
742+
int unescape_len = convert_UTF32_to_UTF8(buffer, ch);
745743
buffer += unescape_len;
746744
p = ++pe;
747745
break;

0 commit comments

Comments
 (0)