summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/array.cc7
-rw-r--r--src/source.cc9
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