aboutsummaryrefslogtreecommitdiff
path: root/include/std
diff options
context:
space:
mode:
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))