Minimize StringMap structure usage

This commit is contained in:
gingerBill
2023-01-14 12:33:42 +00:00
parent 1064bcd060
commit 1ab90de493
9 changed files with 146 additions and 119 deletions

View File

@@ -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;
}