added a few error checks to stack and queue, need to test

This commit is contained in:
herbglitch 2024-02-08 03:17:04 -07:00
parent 314f490bef
commit b4eaee5242
2 changed files with 19 additions and 4 deletions

View file

@ -32,7 +32,12 @@ void ARC_Stack_Destroy(ARC_Stack *stack){
}
void ARC_Stack_Push(ARC_Stack *stack, void *data){
//TODO: check if size exceeds uint32_t
if(stack->currentSize == ~(uint32_t)0){
arc_errno = ARC_ERRNO_OVERFLOW;
ARC_DEBUG_ERR("ARC_Stack_Push(stack) called, size of stack is maxed, cannot add another node");
return;
}
ARC_StackNode *node = (ARC_StackNode *)malloc(sizeof(ARC_StackNode));
node->data = data;
node->next = NULL;