From edfbed056fa5d744690d48abc1a0f6a1b9cf1569 Mon Sep 17 00:00:00 2001
From: John MacFarlane <fiddlosopher@gmail.com>
Date: Thu, 6 Nov 2014 10:32:29 -0800
Subject: Use render stack for inline links.

---
 src/html/html.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

(limited to 'src')

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:
-- 
cgit v1.2.3