From 751fb7894ccca3a89c4f14cb5c99ff39be957455 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 24 Oct 2014 08:00:05 -0700 Subject: Renamed subj->last_emphasis to subj->emphasis_openers. --- TODO | 7 +++++++ src/inlines.c | 16 ++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/TODO b/TODO index 8b13789..be547e8 100644 --- a/TODO +++ b/TODO @@ -1 +1,8 @@ +- leakcheck reveals leak in new stmd code + Create a function to remove and free a stack entry + Use a while loop to remove and free all stack entries from top to the + one we're matching. +- use name other than subj->last_emphasis + +- in js: make a proper stack (linked list) rather than using an array? diff --git a/src/inlines.c b/src/inlines.c index a6d947c..a736ec6 100644 --- a/src/inlines.c +++ b/src/inlines.c @@ -22,7 +22,7 @@ typedef struct Subject { int pos; int label_nestlevel; reference_map *refmap; - inline_stack *last_emphasis; + inline_stack *emphasis_openers; } subject; static node_inl *parse_chunk_inlines(chunk *chunk, reference_map *refmap); @@ -166,7 +166,7 @@ static void subject_from_buf(subject *e, strbuf *buffer, reference_map *refmap) e->pos = 0; e->label_nestlevel = 0; e->refmap = refmap; - e->last_emphasis = NULL; + e->emphasis_openers = NULL; chunk_rtrim(&e->input); } @@ -179,7 +179,7 @@ static void subject_from_chunk(subject *e, chunk *chunk, reference_map *refmap) e->pos = 0; e->label_nestlevel = 0; e->refmap = refmap; - e->last_emphasis = NULL; + e->emphasis_openers = NULL; chunk_rtrim(&e->input); } @@ -310,7 +310,7 @@ static node_inl* handle_strong_emph(subject* subj, char c, node_inl **last) if (can_close) { // walk the stack and find a matching opener, if there is one - istack = subj->last_emphasis; + istack = subj->emphasis_openers; while (true) { if (istack == NULL) @@ -336,7 +336,7 @@ static node_inl* handle_strong_emph(subject* subj, char c, node_inl **last) inl->content.inlines = inl->next; inl->next = NULL; - subj->last_emphasis = istack->previous; + subj->emphasis_openers = istack->previous; istack->previous = NULL; *last = inl; free(istack); @@ -372,8 +372,8 @@ cannotClose: istack->delim_count = numdelims; istack->delim_char = c; istack->first_inline = inl_text; - istack->previous = subj->last_emphasis; - subj->last_emphasis = istack; + istack->previous = subj->emphasis_openers; + subj->emphasis_openers = istack; } return inl_text; @@ -728,7 +728,7 @@ extern node_inl* parse_inlines_while(subject* subj, int (*f)(subject*)) } } - inline_stack* istack = subj->last_emphasis; + inline_stack* istack = subj->emphasis_openers; inline_stack* temp; while (istack != NULL) { temp = istack->previous; -- cgit v1.2.3