feat(doubly linked list): implemented is empty function
This commit is contained in:
parent
620ce5668c
commit
984f893885
2 changed files with 6 additions and 0 deletions
|
|
@ -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_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);
|
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
|
#endif
|
||||||
|
|
@ -166,6 +166,10 @@ int main() {
|
||||||
test_doubly_linked_list_node = test_doubly_linked_list_node->previous;
|
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);
|
fledasty_doubly_list_destroy(&test_doubly_linked_list);
|
||||||
printf("Done\n");
|
printf("Done\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue