summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2014-11-14 14:25:58 -0800
committerJohn MacFarlane <fiddlosopher@gmail.com>2014-11-14 14:25:58 -0800
commit677f03e43b47d1339e0ac223e145918e462bc0e1 (patch)
treed1dd6e89d183c9b1e3b012be6b103b4e7a6785ac /src
parent5f1eb2c06fa0728107edd40ff1b6c31ac5dd49a8 (diff)
Exported some functions from buffer that are used elsewhere.
Diffstat (limited to 'src')
-rw-r--r--src/buffer.h42
-rw-r--r--src/html/houdini_html_u.c1
2 files changed, 23 insertions, 20 deletions
diff --git a/src/buffer.h b/src/buffer.h
index 7214faf..40e3d11 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -27,7 +27,7 @@ extern unsigned char cmark_strbuf__oom[];
* initialization.
*/
CMARK_EXPORT
-extern void cmark_strbuf_init(cmark_strbuf *buf, int initial_size);
+void cmark_strbuf_init(cmark_strbuf *buf, int initial_size);
/**
* Attempt to grow the buffer to hold at least `target_size` bytes.
@@ -38,7 +38,7 @@ extern void cmark_strbuf_init(cmark_strbuf *buf, int initial_size);
* that buffer was not expanded.
*/
CMARK_EXPORT
-extern int cmark_strbuf_try_grow(cmark_strbuf *buf, int target_size, bool mark_oom);
+int cmark_strbuf_try_grow(cmark_strbuf *buf, int target_size, bool mark_oom);
/**
* Grow the buffer to hold at least `target_size` bytes.
@@ -48,15 +48,16 @@ extern int cmark_strbuf_try_grow(cmark_strbuf *buf, int target_size, bool mark_o
*
* @return 0 on success or -1 on failure
*/
-static inline int cmark_strbuf_grow(cmark_strbuf *buf, int target_size)
+CMARK_EXPORT
+inline int cmark_strbuf_grow(cmark_strbuf *buf, int target_size)
{
return cmark_strbuf_try_grow(buf, target_size, true);
}
CMARK_EXPORT
-extern void cmark_strbuf_free(cmark_strbuf *buf);
+void cmark_strbuf_free(cmark_strbuf *buf);
CMARK_EXPORT
-extern void cmark_strbuf_swap(cmark_strbuf *buf_a, cmark_strbuf *buf_b);
+void cmark_strbuf_swap(cmark_strbuf *buf_a, cmark_strbuf *buf_b);
/**
* Test if there have been any reallocation failures with this strbuf.
@@ -69,26 +70,27 @@ extern void cmark_strbuf_swap(cmark_strbuf *buf_a, cmark_strbuf *buf_b);
*
* @return false if no error, true if allocation error
*/
-static inline bool cmark_strbuf_oom(const cmark_strbuf *buf)
+CMARK_EXPORT
+inline bool cmark_strbuf_oom(const cmark_strbuf *buf)
{
return (buf->ptr == cmark_strbuf__oom);
}
-
-static inline size_t cmark_strbuf_len(const cmark_strbuf *buf)
+CMARK_EXPORT
+inline size_t cmark_strbuf_len(const cmark_strbuf *buf)
{
return buf->size;
}
CMARK_EXPORT
-extern int cmark_strbuf_cmp(const cmark_strbuf *a, const cmark_strbuf *b);
+int cmark_strbuf_cmp(const cmark_strbuf *a, const cmark_strbuf *b);
CMARK_EXPORT
-extern void cmark_strbuf_attach(cmark_strbuf *buf, unsigned char *ptr, int asize);
+void cmark_strbuf_attach(cmark_strbuf *buf, unsigned char *ptr, int asize);
CMARK_EXPORT
-extern unsigned char *cmark_strbuf_detach(cmark_strbuf *buf);
+unsigned char *cmark_strbuf_detach(cmark_strbuf *buf);
CMARK_EXPORT
-extern void cmark_strbuf_copy_cstr(char *data, int datasize, const cmark_strbuf *buf);
+void cmark_strbuf_copy_cstr(char *data, int datasize, const cmark_strbuf *buf);
static inline const char *cmark_strbuf_cstr(const cmark_strbuf *buf)
{
@@ -106,22 +108,22 @@ static inline const char *cmark_strbuf_cstr(const cmark_strbuf *buf)
* strbuf_oom at the end.
*/
CMARK_EXPORT
-extern int cmark_strbuf_set(cmark_strbuf *buf, const unsigned char *data, int len);
+int cmark_strbuf_set(cmark_strbuf *buf, const unsigned char *data, int len);
CMARK_EXPORT
-extern int cmark_strbuf_sets(cmark_strbuf *buf, const char *string);
+int cmark_strbuf_sets(cmark_strbuf *buf, const char *string);
CMARK_EXPORT
-extern int cmark_strbuf_putc(cmark_strbuf *buf, int c);
+int cmark_strbuf_putc(cmark_strbuf *buf, int c);
CMARK_EXPORT
-extern int cmark_strbuf_put(cmark_strbuf *buf, const unsigned char *data, int len);
+int cmark_strbuf_put(cmark_strbuf *buf, const unsigned char *data, int len);
CMARK_EXPORT
-extern int cmark_strbuf_puts(cmark_strbuf *buf, const char *string);
+int cmark_strbuf_puts(cmark_strbuf *buf, const char *string);
CMARK_EXPORT
-extern int cmark_strbuf_printf(cmark_strbuf *buf, const char *format, ...)
+int cmark_strbuf_printf(cmark_strbuf *buf, const char *format, ...)
__attribute__((format (printf, 2, 3)));
CMARK_EXPORT
-extern int cmark_strbuf_vprintf(cmark_strbuf *buf, const char *format, va_list ap);
+int cmark_strbuf_vprintf(cmark_strbuf *buf, const char *format, va_list ap);
CMARK_EXPORT
-extern void cmark_strbuf_clear(cmark_strbuf *buf);
+void cmark_strbuf_clear(cmark_strbuf *buf);
CMARK_EXPORT
int cmark_strbuf_strchr(const cmark_strbuf *buf, int c, int pos);
diff --git a/src/html/houdini_html_u.c b/src/html/houdini_html_u.c
index 49b4956..b88b9d1 100644
--- a/src/html/houdini_html_u.c
+++ b/src/html/houdini_html_u.c
@@ -2,6 +2,7 @@
#include <stdio.h>
#include <string.h>
+#include "buffer.h"
#include "houdini.h"
#include "utf8.h"
#include "html_unescape.h"