summaryrefslogtreecommitdiff
path: root/memory.c
diff options
context:
space:
mode:
Diffstat (limited to 'memory.c')
-rw-r--r--memory.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/memory.c b/memory.c
index 2d7e566..b5c6a70 100644
--- a/memory.c
+++ b/memory.c
@@ -38,8 +38,11 @@ void* imp_arena_alloc(
Arena* a,
int size
) {
+ char* r;
assert(a->ptr + size < a->size);
- return &a->buf[a->ptr += size];
+ r = &a->buf[a->ptr];
+ a->ptr += size;
+ return r;
}
void* arena_alloc(
@@ -61,7 +64,7 @@ void* arena_alloc_aligned(
void* p;
p = imp_arena_alloc(
a,
- size
+ size + align + 1
);
return (void*)align_address((uintptr_t)p, align);
}