aboutsummaryrefslogtreecommitdiffstats
path: root/src/stack.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/stack.h')
-rw-r--r--src/stack.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/stack.h b/src/stack.h
index 40e8065d..94e091a1 100644
--- a/src/stack.h
+++ b/src/stack.h
@@ -19,21 +19,26 @@ typedef struct {
} SerdStack;
static inline SerdStack
-serd_stack_new(SerdAllocator* const allocator, size_t size, size_t align)
+serd_stack_new(ZixAllocator* const allocator, size_t size, size_t align)
{
const size_t aligned_size = (size + (align - 1)) / align * align;
SerdStack stack;
- stack.buf = (char*)serd_aaligned_calloc(allocator, align, aligned_size);
+ stack.buf = (char*)zix_aligned_alloc(allocator, align, aligned_size);
stack.buf_size = size;
stack.size = align; // 0 is reserved for null
+
+ if (stack.buf) {
+ memset(stack.buf, 0, size);
+ }
+
return stack;
}
static inline void
-serd_stack_free(SerdAllocator* const allocator, SerdStack* stack)
+serd_stack_free(ZixAllocator* const allocator, SerdStack* stack)
{
- serd_aaligned_free(allocator, stack->buf);
+ zix_aligned_free(allocator, stack->buf);
stack->buf = NULL;
stack->buf_size = 0;
stack->size = 0;