aboutsummaryrefslogtreecommitdiff
path: root/include/std
diff options
context:
space:
mode:
Diffstat (limited to 'include/std')
-rw-r--r--include/std/buffer.h3
-rw-r--r--include/std/scoped_allocator.h4
2 files changed, 5 insertions, 2 deletions
diff --git a/include/std/buffer.h b/include/std/buffer.h
index aa82bcc..af6b986 100644
--- a/include/std/buffer.h
+++ b/include/std/buffer.h
@@ -12,6 +12,9 @@ typedef struct {
char* data;
usize size;
usize capacity;
+
+ ScopedAllocator *allocator;
+ usize allocator_index;
} Buffer;
CHECK_RESULT int buffer_init(Buffer *self, struct ScopedAllocator *allocator);
diff --git a/include/std/scoped_allocator.h b/include/std/scoped_allocator.h
index d7ec1e1..60abcce 100644
--- a/include/std/scoped_allocator.h
+++ b/include/std/scoped_allocator.h
@@ -15,9 +15,9 @@ struct ScopedAllocatorNode {
struct ScopedAllocator {
ScopedAllocatorNode head;
ScopedAllocatorNode *current;
+ Buffer/*<void*>*/ mems;
/* TODO: Use linked-list instead, since the elements are dynamically allocated anyways */
/* Find another way to store mutexes */
- Buffer/*<Buffer*>*/ buffers;
Buffer/*<amal_mutex*>*/ mutexes;
};
@@ -27,7 +27,7 @@ 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);
+CHECK_RESULT int scoped_allocator_add_mem(ScopedAllocator *self, usize *result_index);
CHECK_RESULT int scoped_allocator_create_mutex(ScopedAllocator *self, amal_mutex **mutex);
#endif