summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2014-11-18 01:38:50 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2014-11-17 21:43:47 -0800
commit4a7d4e01348660c8deb71bd55231439a4149ab05 (patch)
tree62de76cf9978c5ccae4f737e2ca593981057cd06
parent9fe3b46ddb58ebcd2a94e59e5687fd439d0ead32 (diff)
Set last_child and parent in make_link
-rw-r--r--src/inlines.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/inlines.c b/src/inlines.c
index 57f4b28..a8d14fb 100644
--- 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));