From 403a3401a210b01f3a9cdc828b3d9b5efdb68496 Mon Sep 17 00:00:00 2001 From: MarcUs7i Date: Thu, 20 Mar 2025 16:05:30 +0100 Subject: [PATCH] Removed the empty checks when asked from Mr. Schraml --- simple_singly_linked_list.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/simple_singly_linked_list.c b/simple_singly_linked_list.c index ca0e960..4a73bde 100644 --- a/simple_singly_linked_list.c +++ b/simple_singly_linked_list.c @@ -154,10 +154,6 @@ int list_get_size(IntList list) { return 0; } - if (list_is_empty(list)) { - return 0; - } - int size = 0; IntListNode current = list->head; while (current != 0) { @@ -178,7 +174,7 @@ int list_get_size(IntList list) { * `false ` otherwise. */ bool list_contains(IntList list, int value) { - if (!list_is_valid(list) || list_is_empty(list)) { + if (!list_is_valid(list)) { return false; } @@ -202,7 +198,7 @@ bool list_contains(IntList list, int value) { * is not available. */ int list_get_at(IntList list, unsigned int index) { - if (!list_is_valid(list) || list_is_empty(list)) { + if (!list_is_valid(list)) { return 0; }