diff options
| author | gingerBill <bill@gingerbill.org> | 2023-01-14 12:33:42 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2023-01-14 12:33:42 +0000 |
| commit | 1ab90de4931f07ea61b1195de602f282a853568b (patch) | |
| tree | 1e5ef6379eeefc1fed8da78948bd6d38e472bdfb /src/common_memory.cpp | |
| parent | 1064bcd0602c9ff86e2a304ecb46b8d86bb07d52 (diff) | |
Minimize `StringMap` structure usage
Diffstat (limited to 'src/common_memory.cpp')
| -rw-r--r-- | src/common_memory.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/common_memory.cpp b/src/common_memory.cpp index 7d5d1f27a..22b91d8cb 100644 --- a/src/common_memory.cpp +++ b/src/common_memory.cpp @@ -509,15 +509,15 @@ gb_internal GB_ALLOCATOR_PROC(heap_allocator_proc) { template <typename T> -gb_internal void resize_array_raw(T **array, gbAllocator const &a, isize old_count, isize new_count) { +gb_internal isize resize_array_raw(T **array, gbAllocator const &a, isize old_count, isize new_count) { GB_ASSERT(new_count >= 0); if (new_count == 0) { gb_free(a, *array); *array = nullptr; - return; + return 0; } if (new_count < old_count) { - return; + return old_count; } isize old_size = old_count * gb_size_of(T); isize new_size = new_count * gb_size_of(T); @@ -525,5 +525,6 @@ gb_internal void resize_array_raw(T **array, gbAllocator const &a, isize old_cou auto new_data = cast(T *)gb_resize_align(a, *array, old_size, new_size, alignment); GB_ASSERT(new_data != nullptr); *array = new_data; + return new_count; } |