diff options
| author | Fabrice <fabrice@schaub-dev.xyz> | 2026-03-02 12:45:50 +0100 |
|---|---|---|
| committer | Fabrice <fabrice@schaub-dev.xyz> | 2026-03-02 12:45:50 +0100 |
| commit | f8f8d483f62cfabdada34c2b24509bbe457e87ef (patch) | |
| tree | b824bf42c2427b0f2d83a4a35332942a097bd995 /src | |
| parent | 01fe9f2eeab8b54487a4673e74851160adb1718d (diff) | |
working on array and fixing errors
Diffstat (limited to 'src')
| -rw-r--r-- | src/array.cc | 7 | ||||
| -rw-r--r-- | src/source.cc | 9 |
2 files changed, 9 insertions, 7 deletions
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<T>{Slice<T>{}, allocator} +#define array_init(T, allocator) \ + Array<T> { Slice<T>{}, allocator } -template<typename T> +template <typename T> void array_deinit(Array<T>* 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<Buffer> buffers; + Array<Buffer> 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 |
