aboutsummaryrefslogtreecommitdiff
path: root/src/common.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/common.cpp')
-rw-r--r--src/common.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/common.cpp b/src/common.cpp
index ed1fd16e2..8085e895c 100644
--- a/src/common.cpp
+++ b/src/common.cpp
@@ -73,16 +73,18 @@ GB_ALLOCATOR_PROC(heap_allocator_proc) {
ptr = _aligned_realloc(old_memory, size, alignment);
break;
#else
- case gbAllocation_Alloc:
+ case gbAllocation_Alloc: {
+ isize aligned_size = align_formula_isize(size, alignment);
// TODO(bill): Make sure this is aligned correctly
- ptr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, align_formula_isize(size, alignment));
- break;
+ ptr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, aligned_size);
+ } break;
case gbAllocation_Free:
HeapFree(GetProcessHeap(), 0, old_memory);
break;
- case gbAllocation_Resize:
- ptr = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, old_memory, align_formula_isize(size, alignment));
- break;
+ case gbAllocation_Resize: {
+ isize aligned_size = align_formula_isize(size, alignment);
+ ptr = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, old_memory, aligned_size);
+ } break;
#endif
#elif defined(GB_SYSTEM_LINUX)