Skip to content

Commit 7601d79

Browse files
committed
Code style nits
1 parent 002bb63 commit 7601d79

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

ext/dom/html5_parser.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,12 @@ static lexbor_libxml2_bridge_status lexbor_libxml2_bridge_convert(lxb_dom_node_t
126126
xmlNodePtr lxml_text;
127127
if (compact_text_nodes && data_length < LXML_INTERNED_STRINGS_SIZE) {
128128
/* See xmlSAX2TextNode() in libxml2 */
129-
lxml_text = xmlMalloc(sizeof(xmlNode));
129+
lxml_text = xmlMalloc(sizeof(*lxml_text));
130130
if (UNEXPECTED(lxml_text == NULL)) {
131131
retval = LEXBOR_LIBXML2_BRIDGE_STATUS_OOM;
132132
goto out;
133133
}
134-
memset(lxml_text, 0, sizeof(xmlNode));
134+
memset(lxml_text, 0, sizeof(*lxml_text));
135135
lxml_text->name = xmlStringText;
136136
lxml_text->type = XML_TEXT_NODE;
137137
lxml_text->doc = lxml_doc;

ext/dom/html_document.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ static void dom_decoding_encoding_ctx_init(dom_decoding_encoding_ctx *ctx)
8383
ctx->decode_data = NULL;
8484
/* Set fast path on by default so that the decoder finishing is skipped if this was never initialised properly. */
8585
ctx->fast_path = true;
86-
(void) lxb_encoding_encode_init(&ctx->encode, ctx->encode_data, ctx->encoding_output, sizeof(ctx->encoding_output) / sizeof(lxb_char_t));
86+
(void) lxb_encoding_encode_init(&ctx->encode, ctx->encode_data, ctx->encoding_output, sizeof(ctx->encoding_output) / sizeof(*ctx->encoding_output));
8787
(void) lxb_encoding_encode_replace_set(&ctx->encode, LXB_ENCODING_REPLACEMENT_BYTES, LXB_ENCODING_REPLACEMENT_SIZE);
8888
}
8989

@@ -389,7 +389,7 @@ static void dom_setup_parser_encoding_manually(const lxb_char_t *buf_start, cons
389389

390390
decoding_encoding_ctx->decode_data = encoding_data;
391391

392-
(void) lxb_encoding_decode_init(&decoding_encoding_ctx->decode, decoding_encoding_ctx->decode_data, decoding_encoding_ctx->codepoints, sizeof(decoding_encoding_ctx->codepoints) / sizeof(lxb_codepoint_t));
392+
(void) lxb_encoding_decode_init(&decoding_encoding_ctx->decode, decoding_encoding_ctx->decode_data, decoding_encoding_ctx->codepoints, sizeof(decoding_encoding_ctx->codepoints) / sizeof(*decoding_encoding_ctx->codepoints));
393393
(void) lxb_encoding_decode_replace_set(&decoding_encoding_ctx->decode, &replacement_codepoint, LXB_ENCODING_REPLACEMENT_BUFFER_LEN);
394394
decoding_encoding_ctx->fast_path = decoding_encoding_ctx->decode_data == decoding_encoding_ctx->encode_data; /* Note: encode_data is for UTF-8 */
395395

@@ -947,8 +947,8 @@ static zend_result dom_common_save(dom_output_ctx *output_ctx, const xmlDoc *doc
947947
lxb_encoding_decode_t decode;
948948
lxb_char_t encoding_output[4096];
949949
lxb_codepoint_t codepoints[4096];
950-
(void) lxb_encoding_encode_init(&encode, encoding_data, encoding_output, sizeof(encoding_output) / sizeof(lxb_char_t));
951-
(void) lxb_encoding_decode_init(&decode, decoding_data, codepoints, sizeof(codepoints) / sizeof(lxb_codepoint_t));
950+
(void) lxb_encoding_encode_init(&encode, encoding_data, encoding_output, sizeof(encoding_output) / sizeof(*encoding_output));
951+
(void) lxb_encoding_decode_init(&decode, decoding_data, codepoints, sizeof(codepoints) / sizeof(*codepoints));
952952
if (encoding_data->encoding == LXB_ENCODING_UTF_8) {
953953
lxb_encoding_encode_replace_set(&encode, LXB_ENCODING_REPLACEMENT_BYTES, LXB_ENCODING_REPLACEMENT_SIZE);
954954
} else {

0 commit comments

Comments
 (0)