aboutsummaryrefslogtreecommitdiff
path: root/include/std
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2019-04-22 02:34:30 +0200
committerdec05eba <dec05eba@protonmail.com>2020-07-25 14:36:46 +0200
commita76ba1b33e397638c4209dd77e6073e423ac07a8 (patch)
tree0ef62209546ba91d53a2fabb54f3b8ac9dcfafdf /include/std
parent6a9466da5377d0bc73c7e5aa48deca3740d3de6f (diff)
Start on bytecode. Commit before os switch
Diffstat (limited to 'include/std')
-rw-r--r--include/std/buffer.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/include/std/buffer.h b/include/std/buffer.h
index 723ef6c..aa82bcc 100644
--- a/include/std/buffer.h
+++ b/include/std/buffer.h
@@ -16,13 +16,19 @@ typedef struct {
CHECK_RESULT int buffer_init(Buffer *self, struct ScopedAllocator *allocator);
-/* @data can be NULL */
+/*
+@data can't be null. Use @buffer_append_empty if you want to change the size
+of the buffer without adding data
+*/
CHECK_RESULT int buffer_append(Buffer *self, const void *data, usize size);
+CHECK_RESULT int buffer_append_empty(Buffer *self, usize size);
+/* Expand buffer capacity without changing size */
+CHECK_RESULT int buffer_expand(Buffer *self, usize size);
void* buffer_get(Buffer *self, usize index, usize type_size);
CHECK_RESULT int buffer_pop(Buffer *self, void *data, usize size);
/* Set buffer size to 0, doesn't reallocate */
void buffer_clear(Buffer *self);
-void* buffer_start(Buffer *self);
+void* buffer_begin(Buffer *self);
void* buffer_end(Buffer *self);
usize __buffer_get_size(Buffer *self, usize type_size);
#define buffer_get_size(self, type) __buffer_get_size((self), sizeof(type))