summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2014-11-06 10:32:29 -0800
committerJohn MacFarlane <fiddlosopher@gmail.com>2014-11-06 10:32:29 -0800
commitedfbed056fa5d744690d48abc1a0f6a1b9cf1569 (patch)
treebe324907a0f100f88684092cc13ea61c601dd330
parent7c520ecc5e3971c6c9373309eaef8b3527f85261 (diff)
Use render stack for inline links.
-rw-r--r--src/html/html.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/html/html.c b/src/html/html.c
index 5945476..6261b9c 100644
--- a/src/html/html.c
+++ b/src/html/html.c
@@ -34,6 +34,9 @@ static render_stack* push_inline(render_stack* rstack,
{
render_stack* newstack;
newstack = (render_stack*)malloc(sizeof(render_stack));
+ if (newstack == NULL) {
+ return NULL;
+ }
newstack->previous = rstack;
newstack->next_sibling.inl = inl;
newstack->literal = literal;
@@ -47,6 +50,9 @@ static render_stack* push_block(render_stack* rstack,
{
render_stack* newstack;
newstack = (render_stack*)malloc(sizeof(render_stack));
+ if (newstack == NULL) {
+ return NULL;
+ }
newstack->previous = rstack;
newstack->next_sibling.block = block;
newstack->literal = literal;
@@ -136,8 +142,8 @@ static void inlines_to_html(strbuf *html, node_inl* ils)
}
strbuf_puts(html, "\">");
- inlines_to_html(html, ils->content.inlines);
- strbuf_puts(html, "</a>");
+ children = ils->content.inlines;
+ rstack = push_inline(rstack, ils->next, "</a>");
break;
case INL_IMAGE: