summaryrefslogtreecommitdiff
path: root/src/xml.c
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-07-25 16:08:00 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2015-07-25 16:08:00 -0700
commitb018c01fad3b0c6dd9c180b3ba804baee326d9dd (patch)
treec544cede3e729197a9a676748b8b29a7acf8b1b8 /src/xml.c
parent20ffc3898f02964356e05bb0063904c363e9582d (diff)
xml renderer - use sprintf to avoid strbuf_sprintf.
Diffstat (limited to 'src/xml.c')
-rw-r--r--src/xml.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/xml.c b/src/xml.c
index 815afa5..2882f50 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -37,6 +37,7 @@ S_render_node(cmark_node *node, cmark_event_type ev_type,
bool literal = false;
cmark_delim_type delim;
bool entering = (ev_type == CMARK_EVENT_ENTER);
+ char buffer[100];
if (entering) {
indent(state);
@@ -44,11 +45,12 @@ S_render_node(cmark_node *node, cmark_event_type ev_type,
cmark_strbuf_puts(xml, cmark_node_get_type_string(node));
if (options & CMARK_OPT_SOURCEPOS && node->start_line != 0) {
- cmark_strbuf_printf(xml, " sourcepos=\"%d:%d-%d:%d\"",
- node->start_line,
- node->start_column,
- node->end_line,
- node->end_column);
+ sprintf(buffer, " sourcepos=\"%d:%d-%d:%d\"",
+ node->start_line,
+ node->start_column,
+ node->end_line,
+ node->end_column);
+ cmark_strbuf_puts(xml, buffer);
}
literal = false;
@@ -70,8 +72,9 @@ S_render_node(cmark_node *node, cmark_event_type ev_type,
switch (cmark_node_get_list_type(node)) {
case CMARK_ORDERED_LIST:
cmark_strbuf_puts(xml, " type=\"ordered\"");
- cmark_strbuf_printf(xml, " start=\"%d\"",
- cmark_node_get_list_start(node));
+ sprintf(buffer," start=\"%d\"",
+ cmark_node_get_list_start(node));
+ cmark_strbuf_puts(xml, buffer);
delim = cmark_node_get_list_delim(node);
if (delim == CMARK_PAREN_DELIM) {
cmark_strbuf_puts(xml,
@@ -87,13 +90,15 @@ S_render_node(cmark_node *node, cmark_event_type ev_type,
default:
break;
}
- cmark_strbuf_printf(xml, " tight=\"%s\"",
- (cmark_node_get_list_tight(node) ?
- "true" : "false"));
+ sprintf(buffer, " tight=\"%s\"",
+ (cmark_node_get_list_tight(node) ?
+ "true" : "false"));
+ cmark_strbuf_puts(xml, buffer);
break;
case CMARK_NODE_HEADER:
- cmark_strbuf_printf(xml, " level=\"%d\"",
- node->as.header.level);
+ sprintf(buffer, " level=\"%d\"",
+ node->as.header.level);
+ cmark_strbuf_puts(xml, buffer);
break;
case CMARK_NODE_CODE_BLOCK:
if (node->as.code.info.len > 0) {