summaryrefslogtreecommitdiff
path: root/src/buffer.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/buffer.h')
-rw-r--r--src/buffer.h42
1 files changed, 22 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);