summaryrefslogtreecommitdiff
path: root/src/xml.c
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2020-01-18 22:27:13 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2020-01-23 08:25:54 -0800
commit3acbdf0965859c55fa36c65a4c0e17e92012687c (patch)
tree11cb19bc51d83d159f54d5a15be0533c4dfb3d96 /src/xml.c
parentdf7ef9ed7b5f418897df557c9de88eaba2174703 (diff)
Use C string instead of chunk for code info and literal
Use zero-terminated C strings instead of cmark_chunks without storing the length. The length of code literals will be readded in a later commit. strlen overhead for code info should be negligible. Reduces size of struct cmark_node by 8 bytes.
Diffstat (limited to 'src/xml.c')
-rw-r--r--src/xml.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/xml.c b/src/xml.c
index 48674cc..bd82f5f 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -95,13 +95,14 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type,
cmark_strbuf_puts(xml, buffer);
break;
case CMARK_NODE_CODE_BLOCK:
- if (node->as.code.info.len > 0) {
+ if (node->as.code.info) {
cmark_strbuf_puts(xml, " info=\"");
- escape_xml(xml, node->as.code.info.data, node->as.code.info.len);
+ escape_xml(xml, node->as.code.info, strlen((char *)node->as.code.info));
cmark_strbuf_putc(xml, '"');
}
cmark_strbuf_puts(xml, " xml:space=\"preserve\">");
- escape_xml(xml, node->as.code.literal.data, node->as.code.literal.len);
+ escape_xml(xml, node->as.code.literal,
+ strlen((char *)node->as.code.literal));
cmark_strbuf_puts(xml, "</");
cmark_strbuf_puts(xml, cmark_node_get_type_string(node));
literal = true;