From bc5f16f146558a1faf9be6abe034755421f6ecce Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 7 May 2015 10:52:06 -0700 Subject: cmark_consolidate_text_nodes: Avoid an unnecessary string allocation. --- src/iterator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/iterator.c b/src/iterator.c index 6d77ffc..f18e3bf 100644 --- a/src/iterator.c +++ b/src/iterator.c @@ -138,8 +138,8 @@ void cmark_consolidate_text_nodes(cmark_node *root) cmark_node_free(tmp); tmp = next; } - cmark_strbuf_putc(&buf, 0); - cmark_node_set_literal(cur, (char *)buf.ptr); + cmark_chunk_free(&cur->as.literal); + cur->as.literal = cmark_chunk_buf_detach(&buf); } } -- cgit v1.2.3