summaryrefslogtreecommitdiff
path: root/src/cmark.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmark.c')
-rw-r--r--src/cmark.c51
1 files changed, 0 insertions, 51 deletions
diff --git a/src/cmark.c b/src/cmark.c
index d114d1e..b20b84b 100644
--- a/src/cmark.c
+++ b/src/cmark.c
@@ -20,54 +20,3 @@ unsigned char *cmark_markdown_to_html(unsigned char *text, int len)
return result;
}
-// Utility function used by cmark_free_nodes
-static void splice_into_list(cmark_node* e, cmark_node* children) {
- cmark_node * tmp;
- if (children) {
- tmp = children;
- // Find last child
- while (tmp->next) {
- tmp = tmp->next;
- }
- // Splice children into list
- tmp->next = e->next;
- e->next = children;
- }
- return ;
-}
-
-// Free a cmark_node list and any children.
-void cmark_free_nodes(cmark_node *e)
-{
- cmark_node *next;
- while (e != NULL) {
- strbuf_free(&e->string_content);
- switch (e->type){
- case NODE_FENCED_CODE:
- strbuf_free(&e->as.code.info);
- break;
- case NODE_STRING:
- case NODE_INLINE_HTML:
- case NODE_INLINE_CODE:
- cmark_chunk_free(&e->as.literal);
- break;
- case NODE_LINK:
- case NODE_IMAGE:
- free(e->as.link.url);
- free(e->as.link.title);
- splice_into_list(e, e->as.link.label);
- break;
- default:
- break;
- }
- if (e->last_child) {
- // Splice children into list
- e->last_child->next = e->next;
- e->next = e->first_child;
- }
- next = e->next;
- free(e);
- e = next;
- }
-}
-