cmark

My personal build of CMark ✏️

Commit
4a7d4e01348660c8deb71bd55231439a4149ab05
Parent
9fe3b46ddb58ebcd2a94e59e5687fd439d0ead32
Author
Nick Wellnhofer <wellnhofer@aevum.de>
Date

Set last_child and parent in make_link

Diffstat

1 file changed, 3 insertions, 0 deletions

Status File Name N° Changes Insertions Deletions
Modified src/inlines.c 3 3 0
diff --git a/src/inlines.c b/src/inlines.c
@@ -69,9 +69,11 @@ static inline cmark_node *make_link(cmark_node *label, unsigned char *url, unsig
 	if(e != NULL) {
 		e->type = CMARK_NODE_LINK;
 		e->first_child   = label;
+                e->last_child    = label;
 		e->as.link.url   = url;
 		e->as.link.title = title;
 		e->next = NULL;
+                label->parent = e;
 	}
 	return e;
 }
@@ -81,6 +83,7 @@ static inline cmark_node* make_autolink(cmark_node* label, cmark_chunk url, int 
 	return make_link(label, cmark_clean_autolink(&url, is_email), NULL);
 }
 
+// Setting 'last_child' and the parent of 'contents' is up to the caller.
 static inline cmark_node* make_inlines(cmark_node_type t, cmark_node* contents)
 {
 	cmark_node * e = (cmark_node *)calloc(1, sizeof(*e));