diff options
author | David Robillard <d@drobilla.net> | 2022-12-19 17:55:02 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-12-02 18:49:08 -0500 |
commit | 0f9816d67bc67a396607291f845ca2a33c2285a7 (patch) | |
tree | b31fd1b344305dc984a2109084fa183573a0ae43 /src/stack.h | |
parent | 258ea2ff59bbd2127ea446cf4b9676ad3d7fe53d (diff) | |
download | serd-0f9816d67bc67a396607291f845ca2a33c2285a7.tar.gz serd-0f9816d67bc67a396607291f845ca2a33c2285a7.tar.bz2 serd-0f9816d67bc67a396607291f845ca2a33c2285a7.zip |
Use ZixAllocator directly
Diffstat (limited to 'src/stack.h')
-rw-r--r-- | src/stack.h | 13 |
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; |