summaryrefslogtreecommitdiff
path: root/src/html
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-11-18 07:23:48 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2014-11-18 07:23:48 -0800
commit1989e87296bd5d143da262d5ac868605e8310a00 (patch)
tree2d9537ff99931c470380d4b3b8446ba36d836ac4 /src/html
parentea8818b809a2d50a484ab5154352e4d4790df992 (diff)
html: Removed union from RenderStack.
It doesn't make sense to have a union here, and this simplifies the code.
Diffstat (limited to 'src/html')
-rw-r--r--src/html/html.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/html/html.c b/src/html/html.c
index 2ef7206..11db0de 100644
--- a/src/html/html.c
+++ b/src/html/html.c
@@ -13,10 +13,7 @@
typedef struct RenderStack {
struct RenderStack *previous;
char* literal;
- union {
- cmark_node *inl;
- cmark_node *block;
- } next_sibling;
+ cmark_node* next_sibling;
bool tight;
bool trim;
} render_stack;
@@ -41,7 +38,7 @@ static render_stack* push_inline(render_stack* rstack,
return NULL;
}
newstack->previous = rstack;
- newstack->next_sibling.inl = inl;
+ newstack->next_sibling = inl;
newstack->literal = literal;
newstack->tight = false;
newstack->trim = false;
@@ -60,7 +57,7 @@ static render_stack* push_block(render_stack* rstack,
return NULL;
}
newstack->previous = rstack;
- newstack->next_sibling.block = block;
+ newstack->next_sibling = block;
newstack->literal = literal;
newstack->tight = tight;
newstack->trim = trim;
@@ -143,7 +140,7 @@ static void inlines_to_plain_html(strbuf *html, cmark_node* ils)
}
while (ils == NULL && rstack != NULL) {
strbuf_puts(html, rstack->literal);
- ils = rstack->next_sibling.inl;
+ ils = rstack->next_sibling;
rstack = pop_render_stack(rstack);
}
}
@@ -237,7 +234,7 @@ static void inlines_to_html(strbuf *html, cmark_node* ils)
}
while (ils == NULL && rstack != NULL) {
strbuf_puts(html, rstack->literal);
- ils = rstack->next_sibling.inl;
+ ils = rstack->next_sibling;
rstack = pop_render_stack(rstack);
}
}
@@ -365,7 +362,7 @@ static void blocks_to_html(strbuf *html, cmark_node *b)
strbuf_rtrim(html);
}
tight = rstack->tight;
- b = rstack->next_sibling.block;
+ b = rstack->next_sibling;
rstack = pop_render_stack(rstack);
}
}