summaryrefslogtreecommitdiff
path: root/src/inlines.c
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-10-19 13:19:11 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2014-10-19 13:19:11 -0700
commitacfdce9fa8159ec950ec91bd68e8f56b869c0167 (patch)
tree696c7aa22d2994ad16ba54f2e7f0f2310a93cff5 /src/inlines.c
parent50cb546d1c603d7444ec09ff52463c2c01212cb2 (diff)
Removed now-undeeded 'first' parameter in parse_inline.
Diffstat (limited to 'src/inlines.c')
-rw-r--r--src/inlines.c22
1 files 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;