aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/buffer.h2
-rw-r--r--src/buffer.c7
2 files changed, 4 insertions, 5 deletions
diff --git a/include/buffer.h b/include/buffer.h
index 84e0cfa..5339108 100644
--- a/include/buffer.h
+++ b/include/buffer.h
@@ -8,12 +8,12 @@
#define BUFFER_ALLOC_FAIL -1
typedef struct {
- struct ScopedAllocator *allocator;
char* data;
usize size;
usize capacity;
} Buffer;
+struct ScopedAllocator;
CHECK_RESULT int buffer_init(Buffer *self, struct ScopedAllocator *allocator);
CHECK_RESULT int buffer_append(Buffer *self, void *data, usize size);
diff --git a/src/buffer.c b/src/buffer.c
index d5e6d97..a097cbf 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -4,13 +4,12 @@
#include "../include/scoped_allocator.h"
#include <assert.h>
-int buffer_init(Buffer *self, ScopedAllocator *allocator) {
+int buffer_init(Buffer *self, struct ScopedAllocator *allocator) {
self->data = NULL;
self->size = 0;
self->capacity = 0;
- self->allocator = allocator;
- if(self->allocator)
- return scoped_allocator_add_buffer(self->allocator, self);
+ if(allocator)
+ return scoped_allocator_add_buffer(allocator, self);
return 0;
}