diff options
Diffstat (limited to '')
-rw-r--r-- | lib/stack.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/stack.c b/lib/stack.c index acffc1a..02226d3 100644 --- a/lib/stack.c +++ b/lib/stack.c @@ -1,4 +1,4 @@ -#include "stack.h" +#include "lslib.h" #include <stdint.h> #include <stdio.h> @@ -8,14 +8,14 @@ void stack_init(struct Stack* stack, size_t size) { stack->size = 0; stack->capacity = size; - stack->data = malloc(size); + stack->data = xalloc(size); } void stack_push(struct Stack* stack, void* data, size_t len) { size_t new_size = stack->size + len; if (new_size >= stack->capacity) { stack->capacity = new_size * 2; - stack->data = realloc(stack->data, stack->capacity); + stack->data = xrealloc(stack->data, stack->capacity); } memcpy((uint8_t*)stack->data + stack->size, data, len); stack->size += len; |