From e735ad6710a82604a206ad29f6cbcdd7dc4b024c Mon Sep 17 00:00:00 2001 From: Tyler Murphy Date: Sun, 14 May 2023 21:43:02 -0400 Subject: refactor and add su --- lib/stack.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/stack.c') 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 #include @@ -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; -- cgit v1.2.3-freya