cmark

My personal build of CMark ✏️

Commit
7c520ecc5e3971c6c9373309eaef8b3527f85261
Parent
a76a035b7f46a8d943f29ddfd664abb69e837a7a
Author
John MacFarlane <jgm@berkeley.edu>
Date

Use regular strings for literal in render_stack.

Diffstat

1 file changed, 4 insertions, 5 deletions

Status File Name N° Changes Insertions Deletions
Modified src/html/html.c 9 4 5
diff --git a/src/html/html.c b/src/html/html.c
@@ -10,7 +10,7 @@
 
 typedef struct RenderStack {
     struct RenderStack *previous;
-    chunk literal;
+    char* literal;
     union {
 	node_inl *inl;
 	node_block *block;
@@ -24,7 +24,6 @@ static void free_render_stack(render_stack * rstack)
     while (rstack) {
 	tempstack = rstack;
 	rstack = rstack->previous;
-	chunk_free(&(tempstack->literal));
 	free(tempstack);
     }
 }
@@ -37,7 +36,7 @@ static render_stack* push_inline(render_stack* rstack,
     newstack = (render_stack*)malloc(sizeof(render_stack));
     newstack->previous = rstack;
     newstack->next_sibling.inl = inl;
-    newstack->literal = chunk_literal(literal);
+    newstack->literal = literal;
     return newstack;
 }
 
@@ -50,7 +49,7 @@ static render_stack* push_block(render_stack* rstack,
     newstack = (render_stack*)malloc(sizeof(render_stack));
     newstack->previous = rstack;
     newstack->next_sibling.block = block;
-    newstack->literal = chunk_literal(literal);
+    newstack->literal = literal;
     newstack->tight = tight;
     return newstack;
 }
@@ -178,7 +177,7 @@ static void inlines_to_html(strbuf *html, node_inl* ils)
 		    ils = ils->next;
 		}
 		while (ils == NULL && rstack != NULL) {
-		    strbuf_puts(html, rstack->literal.data);
+		    strbuf_puts(html, rstack->literal);
 		    ils = rstack->next_sibling.inl;
 		    rstack = pop_render_stack(rstack);
 		}