From e0544300fb7da9a660a55eaf25f1996af573cd43 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 24 Feb 2019 20:01:58 +0100 Subject: Separate buffers from general allocation, but still have them in scoped allocator --- include/scoped_allocator.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'include/scoped_allocator.h') diff --git a/include/scoped_allocator.h b/include/scoped_allocator.h index 1193439..fdaee2a 100644 --- a/include/scoped_allocator.h +++ b/include/scoped_allocator.h @@ -3,8 +3,10 @@ #include "misc.h" #include "types.h" +#include "buffer.h" typedef struct ScopedAllocatorNode ScopedAllocatorNode; +typedef struct ScopedAllocator ScopedAllocator; struct ScopedAllocatorNode { char *data; @@ -12,10 +14,11 @@ struct ScopedAllocatorNode { ScopedAllocatorNode *next; }; -typedef struct { +struct ScopedAllocator { ScopedAllocatorNode head; ScopedAllocatorNode *current; -} ScopedAllocator; + Buffer buffers; +}; CHECK_RESULT int scoped_allocator_node_init(ScopedAllocatorNode *self); void scoped_allocator_node_deinit(ScopedAllocatorNode *self); @@ -23,5 +26,6 @@ void scoped_allocator_node_deinit(ScopedAllocatorNode *self); CHECK_RESULT int scoped_allocator_init(ScopedAllocator *self); void scoped_allocator_deinit(ScopedAllocator *self); CHECK_RESULT int scoped_allocator_alloc(ScopedAllocator *self, usize size, void **mem); +CHECK_RESULT int scoped_allocator_add_buffer(ScopedAllocator *self, Buffer *buffer); #endif \ No newline at end of file -- cgit v1.2.3