summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-07-25 15:57:19 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2015-07-25 15:57:19 -0700
commitcdc1730336ee8d335e086cf69ff0f46912261b59 (patch)
treea666d3510ca1bbcb68cf4b97ef5fe3f405832c5f
parent2c8ce48a3c75a28ac2f5bee5a2d3b8cfda5e66b3 (diff)
Avoided another use of strbuf_printf.
-rw-r--r--src/commonmark.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/commonmark.c b/src/commonmark.c
index 6462db9..5964c60 100644
--- a/src/commonmark.c
+++ b/src/commonmark.c
@@ -26,6 +26,8 @@ static inline void outc(cmark_renderer *renderer,
unsigned char nextc)
{
bool needs_escaping = false;
+ char encoded[20];
+
needs_escaping =
escape != LITERAL &&
((escape == NORMAL &&
@@ -47,7 +49,8 @@ static inline void outc(cmark_renderer *renderer,
if (needs_escaping) {
if (isspace(c)) {
// use percent encoding for spaces
- cmark_strbuf_printf(renderer->buffer, "%%%2x", c);
+ sprintf(encoded, "%%%2x", c);
+ cmark_strbuf_puts(renderer->buffer, encoded);
renderer->column += 3;
} else {
cmark_render_ascii(renderer, "\\");