diff options
| author | gingerBill <bill@gingerbill.org> | 2021-08-07 15:07:29 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2021-08-07 15:07:29 +0100 |
| commit | 423b84234791678647e726634a26676df3d289b2 (patch) | |
| tree | 367486b32d62268c2927cefc88a6e6679e75a7f1 /src/common.cpp | |
| parent | 16eeae36d719a8499107924c2e24b3c84feee579 (diff) | |
Fix typo
Diffstat (limited to 'src/common.cpp')
| -rw-r--r-- | src/common.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/common.cpp b/src/common.cpp index c9d88d55b..4d98fe08d 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -173,7 +173,7 @@ GB_ALLOCATOR_PROC(heap_allocator_proc) { } break; case gbAllocation_Resize: - if (new_size == 0) { + if (size == 0) { free(old_memory); break; } @@ -182,14 +182,14 @@ GB_ALLOCATOR_PROC(heap_allocator_proc) { gb_zero_size(ptr, size); break; } - if (new_size <= old_size) { + if (size <= old_size) { ptr = old_memory; break; } ptr = aligned_alloc(alignment, (size + alignment - 1) & ~(alignment - 1)); gb_memmove(ptr, old_memory, old_size); - gb_zero_size(cast(u8 *)ptr + old_size, gb_max(new_size-old_size, 0)); + gb_zero_size(cast(u8 *)ptr + old_size, gb_max(size-old_size, 0)); break; #else // TODO(bill): *nix version that's decent @@ -203,7 +203,7 @@ GB_ALLOCATOR_PROC(heap_allocator_proc) { break; case gbAllocation_Resize: - if (new_size == 0) { + if (size == 0) { free(old_memory); break; } @@ -212,14 +212,14 @@ GB_ALLOCATOR_PROC(heap_allocator_proc) { gb_zero_size(ptr, size); break; } - if (new_size <= old_size) { + if (size <= old_size) { ptr = old_memory; break; } posix_memalign(&ptr, alignment, size); gb_memmove(ptr, old_memory, old_size); - gb_zero_size(cast(u8 *)ptr + old_size, gb_max(new_size-old_size, 0)); + gb_zero_size(cast(u8 *)ptr + old_size, gb_max(size-old_size, 0)); break; #endif |