Compare commits
No commits in common. "fee99c8cdd3ae69f1c08941e0b5a86b7cd818fe9" and "d89747a2ed8c2aeaf632b7f9a72b27b3f2605661" have entirely different histories.
fee99c8cdd
...
d89747a2ed
3 changed files with 1 additions and 9 deletions
|
|
@ -25,7 +25,6 @@
|
||||||
#define FLEDASTY_LINKED_LIST
|
#define FLEDASTY_LINKED_LIST
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#include "../Utils/Error.h"
|
#include "../Utils/Error.h"
|
||||||
|
|
||||||
|
|
@ -44,6 +43,4 @@ FledastyError fledasty_linked_list_destroy(FledastyLinkedList *current_linked_li
|
||||||
|
|
||||||
FledastyError fledasty_linked_list_append(FledastyLinkedList *current_linked_list, void *value);
|
FledastyError fledasty_linked_list_append(FledastyLinkedList *current_linked_list, void *value);
|
||||||
|
|
||||||
static inline bool fledasty_linked_list_is_empty(FledastyLinkedList *current_linked_list) { return current_linked_list->size == 0; }
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,6 @@ FledastyError fledasty_linked_list_append(FledastyLinkedList *current_linked_lis
|
||||||
new_node->next = NULL;
|
new_node->next = NULL;
|
||||||
|
|
||||||
current_linked_list->end->next = new_node;
|
current_linked_list->end->next = new_node;
|
||||||
current_linked_list->end = new_node;
|
|
||||||
current_linked_list->size += 1;
|
current_linked_list->size += 1;
|
||||||
|
|
||||||
return FLEDASTY_ERROR_NONE;
|
return FLEDASTY_ERROR_NONE;
|
||||||
|
|
|
||||||
|
|
@ -111,15 +111,11 @@ int main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
FledastyLinkedListNode *test_linked_list_node = test_linked_list.start;
|
FledastyLinkedListNode *test_linked_list_node = test_linked_list.start;
|
||||||
for (int i = 0; i < test_linked_list.size; i += 1) {
|
for (int i = 0; i < test_linked_list.size; i++) {
|
||||||
printf("Linked list get: %d\n", *(int*)test_linked_list_node->value);
|
printf("Linked list get: %d\n", *(int*)test_linked_list_node->value);
|
||||||
test_linked_list_node = test_linked_list_node->next;
|
test_linked_list_node = test_linked_list_node->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fledasty_linked_list_is_empty(&test_linked_list)) {
|
|
||||||
printf("Linked list is empty\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
fledasty_linked_list_destroy(&test_linked_list);
|
fledasty_linked_list_destroy(&test_linked_list);
|
||||||
printf("Done\n");
|
printf("Done\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue