diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-11-13 23:03:16 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-11-13 23:03:16 -0800 |
commit | b700e3c080521021bb7f8eb63a96def24112c16a (patch) | |
tree | e17586fe5c430a9b15a0b1aa5a8550556cb1aaaf /src/cmark.c | |
parent | 549c5dbd45c20fa30f42cd70b734e6447af3f1ba (diff) |
Added cmark_append_blocks, exposed more functions.
Diffstat (limited to 'src/cmark.c')
-rw-r--r-- | src/cmark.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/cmark.c b/src/cmark.c index eacf411..56bbb93 100644 --- a/src/cmark.c +++ b/src/cmark.c @@ -176,9 +176,25 @@ inline cmark_node_inl* cmark_append_inlines(cmark_node_inl* a, cmark_node_inl* b return b; } cmark_node_inl* cur = a; - while (cur->next) { + while (cur->next != NULL) { cur = cur->next; } cur->next = b; return a; } + +// Append block list b to the end of block list a. +// Return pointer to head of new list. +inline cmark_node_block* cmark_append_blocks(cmark_node_block* a, cmark_node_block* b) +{ + if (a == NULL) { // NULL acts like an empty list + return b; + } + cmark_node_block* cur = a; + while (cur->next != NULL) { + cur = cur->next; + } + cur->next = b; + b->prev = cur; + return a; +} |