From f8f8d483f62cfabdada34c2b24509bbe457e87ef Mon Sep 17 00:00:00 2001 From: Fabrice Date: Mon, 2 Mar 2026 12:45:50 +0100 Subject: working on array and fixing errors --- src/array.cc | 7 ++++--- src/source.cc | 9 +++++---- 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/array.cc b/src/array.cc index 7c8cc19..06b79c2 100644 --- a/src/array.cc +++ b/src/array.cc @@ -12,13 +12,14 @@ struct Array { const Allocator* allocator; }; -#define array_init(T, allocator) Array{Slice{}, allocator} +#define array_init(T, allocator) \ + Array { Slice{}, allocator } -template +template void array_deinit(Array* array) { assert(array != nullptr); - if(unlikely(array->allocator == nullptr)) return; + if (unlikely(array->allocator == nullptr)) return; slice_deallocate(array->allocator, &array->buffer); array->allocator = nullptr; diff --git a/src/source.cc b/src/source.cc index 8129df8..b3bf910 100644 --- a/src/source.cc +++ b/src/source.cc @@ -1,9 +1,9 @@ #ifndef SOURCE_CC #define SOURCE_CC +#include "array.cc" #include "common.cc" #include "memory.cc" -#include "array.cc" typedef u32 Source_Id; @@ -48,14 +48,15 @@ void buffer_deinit(Buffer* buffer) { struct Buffer_Manager { Link* stack; - Array buffers; + Array buffers; }; -#define buffer_manager_init(allocator) Buffer_Manager{nullptr, buffer_init(allocator)} +#define buffer_manager_init(allocator) \ + Buffer_Manager { nullptr, array_init(Buffer, allocator) } void buffer_manager_deinit(Buffer_Manager* stack) { assert(stack != nullptr); - array_deinit(&stack->buffers); + array_deinit(&stack->buffers); } #endif -- cgit v1.2.3