cmark

My personal build of CMark ✏️

Commit
bc5f16f146558a1faf9be6abe034755421f6ecce
Parent
1c242b8759413e3c1dd01a083a113b43ae4bff55
Author
John MacFarlane <jgm@berkeley.edu>
Date

cmark_consolidate_text_nodes: Avoid an unnecessary string allocation.

Diffstat

1 file changed, 2 insertions, 2 deletions

Status File Name N° Changes Insertions Deletions
Modified src/iterator.c 4 2 2
diff --git 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);
 		}
 	}