From b2f4a4b8e4d1fcbae9aa48252c449e9560fd9715 Mon Sep 17 00:00:00 2001 From: Maciej Samborski Date: Mon, 23 Sep 2024 19:07:53 +0200 Subject: [PATCH] Removed all exit calls --- ll.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/ll.h b/ll.h index 90c2e95..ae6427c 100644 --- a/ll.h +++ b/ll.h @@ -118,9 +118,8 @@ llList * _llInsert(llList * list, size_t id, void * value) { if (node->next == NULL && id > 1) { - fprintf(stderr, "RUNTIME ERROR: Index out of bounds\n"); - llFree(list); - exit(1); + fprintf(stderr, "ERROR: Index out of bounds\n"); + return list; } prev = node; @@ -154,8 +153,7 @@ llList * _llDelete(llList * list, size_t id) if (node->next == NULL) { fprintf(stderr, "RUNTIME ERROR: Index out of bounds\n"); - llFree(list); - exit(1); + return list; } prev = node; @@ -199,8 +197,7 @@ void * _llGetRef(llList * list, size_t id) if (node->next == NULL) { fprintf(stderr, "RUNTIME ERROR: Index out of bounds\n"); - llFree(list); - exit(1); + return NULL; } node = node->next;