Skip to content

Commit 2f1fe32

Browse files
committed
Use a direct statically-known call for decoding in the fast path
1 parent 82665fd commit 2f1fe32

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ext/dom/html_document.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,8 @@ static bool dom_decode_encode_fast_path(
511511
const lxb_char_t *last_output = buf_ref;
512512
while (buf_ref != buf_end) {
513513
const lxb_char_t *buf_ref_backup = buf_ref;
514-
lxb_codepoint_t codepoint = decoding_encoding_ctx->decode_data->decode_single(&decoding_encoding_ctx->decode, &buf_ref, buf_end);
514+
/* Fast path converts non-validated UTF-8 -> validated UTF-8 */
515+
lxb_codepoint_t codepoint = lxb_encoding_decode_utf_8_single(&decoding_encoding_ctx->decode, &buf_ref, buf_end);
515516
if (UNEXPECTED(codepoint > LXB_ENCODING_MAX_CODEPOINT)) {
516517
size_t skip = buf_ref - buf_ref_backup; /* Skip invalid data, it's replaced by the UTF-8 replacement bytes */
517518
if (!dom_process_parse_chunk(

0 commit comments

Comments
 (0)