summaryrefslogtreecommitdiff
path: root/textbuf.h
diff options
context:
space:
mode:
authorcflip <cflip@cflip.net>2023-01-25 11:28:09 -0700
committercflip <cflip@cflip.net>2023-01-25 18:32:43 -0700
commit723876da5741892530cd74112ec1510124e95cf9 (patch)
tree2017e9e488a073b274c485fbd192ba05724c01c7 /textbuf.h
parent69e2be81c732353f5f89389fec3f9bb768b0766a (diff)
Rename `append_buffer` to textbuf
This name is a little bit better I think, and it will be nice to have a distinction between this utility and the 'file' kind of buffer.
Diffstat (limited to 'textbuf.h')
-rw-r--r--textbuf.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/textbuf.h b/textbuf.h
new file mode 100644
index 0000000..e5e0f03
--- /dev/null
+++ b/textbuf.h
@@ -0,0 +1,22 @@
+/*
+ * textbuf.h: A simple dynamic text buffer.
+ *
+ * This file provides the `textbuf` struct, which is a dynamically allocated
+ * buffer of text.
+ */
+
+#ifndef _BUFFER_H
+#define _BUFFER_H
+
+#include <stddef.h>
+
+struct textbuf {
+ char *buffer;
+ size_t length;
+};
+
+struct textbuf textbuf_init();
+void textbuf_append(struct textbuf *textbuf, const char *str, int len);
+void textbuf_free(struct textbuf *textbuf);
+
+#endif