feat(doubly linked list): implemented is empty function

This commit is contained in:
Mineplay 2025-05-01 03:27:08 -05:00
parent 620ce5668c
commit 984f893885
2 changed files with 6 additions and 0 deletions

View file

@ -48,4 +48,6 @@ FledastyError fledasty_doubly_linked_list_insert_at_index(FledastyDoublyLinkedLi
FledastyError fledasty_doubly_linked_list_insert_before_value(FledastyDoublyLinkedList *current_doubly_linked_list, void *before_value, void *value);
FledastyError fledasty_doubly_linked_list_insert_after_value(FledastyDoublyLinkedList *current_doubly_linked_list, void *after_value, void *value);
static inline bool fledasty_doubly_linked_list_is_empty(const FledastyDoublyLinkedList *current_doubly_linked_list) { return current_doubly_linked_list->size == 0; }
#endif

View file

@ -166,6 +166,10 @@ int main() {
test_doubly_linked_list_node = test_doubly_linked_list_node->previous;
}
if (fledasty_doubly_linked_list_is_empty(&test_doubly_linked_list)) {
printf("Linked list is empty\n");
}
fledasty_doubly_list_destroy(&test_doubly_linked_list);
printf("Done\n");
return 0;