From acfdce9fa8159ec950ec91bd68e8f56b869c0167 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 19 Oct 2014 13:19:11 -0700 Subject: Removed now-undeeded 'first' parameter in parse_inline. --- src/inlines.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/inlines.c b/src/inlines.c index f2a1c63..a6d947c 100644 --- a/src/inlines.c +++ b/src/inlines.c @@ -27,7 +27,7 @@ typedef struct Subject { static node_inl *parse_chunk_inlines(chunk *chunk, reference_map *refmap); static node_inl *parse_inlines_while(subject* subj, int (*f)(subject*)); -static int parse_inline(subject* subj, node_inl ** first, node_inl ** last); +static int parse_inline(subject* subj, node_inl ** last); static void subject_from_chunk(subject *e, chunk *chunk, reference_map *refmap); static void subject_from_buf(subject *e, strbuf *buffer, reference_map *refmap); @@ -720,9 +720,12 @@ inline static int not_eof(subject* subj) extern node_inl* parse_inlines_while(subject* subj, int (*f)(subject*)) { node_inl* result = NULL; - node_inl** first = &result; - node_inl* last = NULL; - while ((*f)(subj) && parse_inline(subj, first, &last)) { + node_inl** last = &result; + node_inl* first = NULL; + while ((*f)(subj) && parse_inline(subj, last)) { + if (!first) { + first = *last; + } } inline_stack* istack = subj->last_emphasis; @@ -733,7 +736,7 @@ extern node_inl* parse_inlines_while(subject* subj, int (*f)(subject*)) istack = temp; } - return result; + return first; } node_inl *parse_chunk_inlines(chunk *chunk, reference_map *refmap) @@ -778,7 +781,7 @@ static int subject_find_special_char(subject *subj) // Parse an inline, advancing subject, and add it to last element. // Adjust tail to point to new last element of list. // Return 0 if no inline can be parsed, 1 otherwise. -static int parse_inline(subject* subj, node_inl ** first, node_inl ** last) +static int parse_inline(subject* subj, node_inl ** last) { node_inl* new = NULL; chunk contents; @@ -838,16 +841,11 @@ static int parse_inline(subject* subj, node_inl ** first, node_inl ** last) new = make_str(contents); } - if (*first == NULL) { - *first = new; + if (*last == NULL) { *last = new; } else if (new) { append_inlines(*last, new); *last = new; - while (new->next) { - new = new->next; - *last = new; - } } return 1; -- cgit v1.2.3