- Commit
- cdc1730336ee8d335e086cf69ff0f46912261b59
- Parent
- 2c8ce48a3c75a28ac2f5bee5a2d3b8cfda5e66b3
- Author
- John MacFarlane <jgm@berkeley.edu>
- Date
Avoided another use of strbuf_printf.
My personal build of CMark ✏️
Avoided another use of strbuf_printf.
1 file changed, 4 insertions, 1 deletion
Status | File Name | N° Changes | Insertions | Deletions |
Modified | src/commonmark.c | 5 | 4 | 1 |
diff --git 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, "\\");