cmark

My personal build of CMark ✏️

Commit
8c34fdc1b2d67ba440f5ad6cc5f81df4a3bcd937
Parent
76b7e4241c840480beaef5ac6b711301f066251e
Author
Nick Wellnhofer <wellnhofer@aevum.de>
Date

Declare all functions as extern "C"

Diffstat

6 files changed, 41 insertions, 0 deletions

Status File Name N° Changes Insertions Deletions
Modified src/buffer.h 8 8 0
Modified src/inlines.h 8 8 0
Modified src/references.h 8 8 0
Modified src/scanners.h 8 8 0
Modified src/scanners.re 1 1 0
Modified src/utf8.h 8 8 0
diff --git a/src/buffer.h b/src/buffer.h
@@ -6,6 +6,10 @@
 #include "config.h"
 #include "cmark_export.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct {
 	unsigned char *ptr;
 	int asize, size;
@@ -164,4 +168,8 @@ void cmark_strbuf_unescape(cmark_strbuf *s);
   #define strbuf_unescape               cmark_strbuf_unescape
 #endif
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/src/inlines.h b/src/inlines.h
@@ -1,6 +1,10 @@
 #ifndef CMARK_INLINES_H
 #define CMARK_INLINES_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 unsigned char *cmark_clean_url(cmark_chunk *url);
 unsigned char *cmark_clean_title(cmark_chunk *title);
 
@@ -15,4 +19,8 @@ int cmark_parse_reference_inline(cmark_strbuf *input, cmark_reference_map *refma
   #define clean_title               cmark_clean_title
 #endif
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/src/references.h b/src/references.h
@@ -4,6 +4,10 @@
 #include "chunk.h"
 #include "ast.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 cmark_reference_map *cmark_reference_map_new(void);
 void cmark_reference_map_free(cmark_reference_map *map);
 cmark_reference* cmark_reference_lookup(cmark_reference_map *map, cmark_chunk *label);
@@ -18,4 +22,8 @@ extern void cmark_reference_create(cmark_reference_map *map, cmark_chunk *label,
   #define reference_create      cmark_reference_create
 #endif
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/src/scanners.h b/src/scanners.h
@@ -1,5 +1,9 @@
 #include "cmark.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 int _scan_at(int (*scanner)(const unsigned char *), chunk *c, int offset);
 int _scan_autolink_uri(const unsigned char *p);
 int _scan_autolink_email(const unsigned char *p);
@@ -28,3 +32,7 @@ int _scan_entity(const unsigned char *p);
 #define scan_open_code_fence(c, n) _scan_at(&_scan_open_code_fence, c, n)
 #define scan_close_code_fence(c, n) _scan_at(&_scan_close_code_fence, c, n)
 #define scan_entity(c, n) _scan_at(&_scan_entity, c, n)
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/scanners.re b/src/scanners.re
@@ -1,5 +1,6 @@
 #include <stdlib.h>
 #include "chunk.h"
+#include "scanners.h"
 
 int _scan_at(int (*scanner)(const unsigned char *), chunk *c, int offset)
 {
diff --git a/src/utf8.h b/src/utf8.h
@@ -4,10 +4,18 @@
 #include <stdint.h>
 #include "buffer.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 void utf8proc_case_fold(cmark_strbuf *dest, const uint8_t *str, int len);
 void utf8proc_encode_char(int32_t uc, cmark_strbuf *buf);
 int utf8proc_iterate(const uint8_t *str, int str_len, int32_t *dst);
 int utf8proc_charlen(const uint8_t *str, int str_len);
 void utf8proc_detab(cmark_strbuf *dest, const uint8_t *line, size_t size);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif