cmark

Unnamed repository; edit this file 'description' to name the repository.

commit b700e3c080521021bb7f8eb63a96def24112c16a
parent 549c5dbd45c20fa30f42cd70b734e6447af3f1ba
Author: John MacFarlane <jgm@berkeley.edu>
Date:   Thu, 13 Nov 2014 23:03:16 -0800

Added cmark_append_blocks, exposed more functions.

Diffstat:
Msrc/cmark.c | 18+++++++++++++++++-
Msrc/cmark.h | 19++++++++++++++++---
2 files changed, 33 insertions(+), 4 deletions(-)
diff --git 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
@@ -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