summaryrefslogtreecommitdiff
path: root/src/buffer.c
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-11-14 15:48:47 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2014-11-14 15:48:47 -0800
commitf2c2f626292ac83519bc478271b5678efcf67586 (patch)
tree0ca124087411d18d1666788679a4e6ea3514023a /src/buffer.c
parent38710f1de71e9bb22b3c602dd05fb558092e1fb1 (diff)
Moved code from buffer.h to buffer.c. Make strbuf_cstr static.
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 6176da5..6219935 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -79,6 +79,21 @@ int cmark_strbuf_try_grow(strbuf *buf, int target_size, bool mark_oom)
return 0;
}
+int cmark_strbuf_grow(cmark_strbuf *buf, int target_size)
+{
+ return cmark_strbuf_try_grow(buf, target_size, true);
+}
+
+bool cmark_strbuf_oom(const cmark_strbuf *buf)
+{
+ return (buf->ptr == cmark_strbuf__oom);
+}
+
+size_t cmark_strbuf_len(const cmark_strbuf *buf)
+{
+ return buf->size;
+}
+
void cmark_strbuf_free(strbuf *buf)
{
if (!buf) return;
@@ -190,6 +205,11 @@ int cmark_strbuf_printf(strbuf *buf, const char *format, ...)
return r;
}
+static inline const char *cmark_strbuf_cstr(const cmark_strbuf *buf)
+{
+ return (char *)buf->ptr;
+}
+
void cmark_strbuf_copy_cstr(char *data, int datasize, const strbuf *buf)
{
int copylen;