summaryrefslogtreecommitdiff
path: root/plugins/static/buffer.h
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/static/buffer.h')
-rw-r--r--plugins/static/buffer.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/plugins/static/buffer.h b/plugins/static/buffer.h
new file mode 100644
index 0000000..0237f7c
--- /dev/null
+++ b/plugins/static/buffer.h
@@ -0,0 +1,21 @@
+#pragma once
+
+#include <stdbool.h>
+#include <stddef.h>
+
+
+struct buffer {
+ char *buf;
+ size_t cap, len;
+};
+
+struct buffer buffer_make(size_t capacity);
+
+void buffer_free(struct buffer buffer);
+
+void buffer_append_mem(struct buffer *buffer, const char *str, size_t len);
+
+void buffer_append_str(struct buffer *buffer, const char *str);
+
+// returns whether successful
+bool buffer_append_file(struct buffer *buffer, const char *path);