summaryrefslogtreecommitdiff
path: root/src/memory.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/memory.cc')
-rw-r--r--src/memory.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/memory.cc b/src/memory.cc
index 22977d1..720c100 100644
--- a/src/memory.cc
+++ b/src/memory.cc
@@ -16,7 +16,7 @@ struct Allocator {
Allocator_Deallocate deallocate;
};
-template<typename T>
+template <typename T>
T* allocate(const Allocator* allocator, usize n) {
return (T*)allocator->allocate(allocator->self, sizeof(T) * n, alignof(T));
}
@@ -48,7 +48,7 @@ const Allocator* heap_allocator() {
template <typename T>
bool slice_copy(const Allocator* allocator, const Slice<T>* source,
Slice<T>* out) {
- T* new_ptr = allocate(allocator, source->size(), alignof(T));
+ T* new_ptr = allocate(allocator, source->total_length(), alignof(T));
if (new_ptr == nullptr) return false;
memcpy((u8*)new_ptr, (u8*)source->ptr, source->length);