summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-11-13 23:03:16 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2014-11-13 23:03:16 -0800
commitb700e3c080521021bb7f8eb63a96def24112c16a (patch)
treee17586fe5c430a9b15a0b1aa5a8550556cb1aaaf /src
parent549c5dbd45c20fa30f42cd70b734e6447af3f1ba (diff)
Added cmark_append_blocks, exposed more functions.
Diffstat (limited to 'src')
-rw-r--r--src/cmark.c18
-rw-r--r--src/cmark.h19
2 files changed, 33 insertions, 4 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;
+}
diff --git a/src/cmark.h b/src/cmark.h
index 7ab3995..1331e76 100644
--- a/src/cmark.h
+++ b/src/cmark.h
@@ -110,16 +110,31 @@ struct cmark_node_block {
typedef struct cmark_node_block cmark_node_block;
+__attribute__((visibility("default")))
void cmark_free_blocks(cmark_node_block *e);
+
+__attribute__((visibility("default")))
void cmark_free_inlines(cmark_node_inl* e);
-void cmark_free_simple(cmark_node_inl *e);
+
+__attribute__((visibility("default")))
cmark_node_inl* cmark_append_inlines(cmark_node_inl* a, cmark_node_inl* b);
+__attribute__((visibility("default")))
+cmark_node_block* cmark_append_blocks(cmark_node_block* a, cmark_node_block* b);
+
+__attribute__((visibility("default")))
cmark_node_inl *cmark_make_link(cmark_node_inl *label, unsigned char *url, unsigned char *title);
+
+__attribute__((visibility("default")))
cmark_node_inl* cmark_make_autolink(cmark_node_inl* label, cmark_chunk url, int is_email);
+__attribute__((visibility("default")))
cmark_node_inl* cmark_make_inlines(int t, cmark_node_inl* contents);
+
+__attribute__((visibility("default")))
cmark_node_inl* cmark_make_literal(int t, cmark_chunk s);
+
+__attribute__((visibility("default")))
cmark_node_inl* cmark_make_simple(int t);
// Macros for creating various kinds of simple.
@@ -146,8 +161,6 @@ void cmark_render_html(cmark_strbuf *html, cmark_node_block *root);
__attribute__((visibility("default")))
unsigned char *cmark_markdown_to_html(unsigned char *text, int len);
-
-
#ifndef CMARK_NO_SHORT_NAMES
#define VERSION CMARK_VERSION
#define CODE_INDENT CMARK_CODE_INDENT