64 return list->
len == 0;
112 if (idx >= list->
len)
128 unsigned int curr_idx = 0;
134 if (idx == curr_idx++)
150 if (idx_a >= list->
len || idx_b >= list->
len)
155 unsigned int curr_idx = 0;
156 unsigned int max_idx = idx_a > idx_b ? idx_a : idx_b;
166 if (idx_a == curr_idx)
171 if (idx_b == curr_idx)
176 }
while (max_idx != curr_idx++);
179 void* tmp = node_a->
data;
203 else if (!node->
prev && !node->
next)
230 if (idx == curr_idx++)
262 .current_node = NULL,
263 .direction = LIST_ITR_FORWARD,
274 .current_node = NULL,
275 .direction = LIST_ITR_REVERSE,
284 return ln ? ln->
data : NULL;
323 if (ln->
data == data)
bool list_swap(List *list, unsigned int idx_a, unsigned int idx_b)
bool list_is_empty(const List *list)
void * list_get_at_idx(List *list, unsigned int idx)
void list_insert(List *list, void *data, unsigned int idx)
static void s_list_remove_node(List *list, ListNode *node)
int list_get_len(const List *list)
static ListNode * s_list_itr_node_next(ListItr *itr)
void list_push_front(List *list, void *data)
ListItr rev_list_itr_create(List *list)
void list_clear(List *list)
void list_itr_remove_current_node(ListItr *itr)
void * list_itr_next(ListItr *itr)
bool list_remove_data(List *list, void *data)
bool list_remove_at_idx(List *list, unsigned int idx)
void list_push_back(List *list, void *data)
ListItr list_itr_create(List *list)
#define LIST_DEFAULT
Default list declaration for empty lists.
ListNode * current_node
The current node in the list iterator.
ListNode * next_node
The next node in the list.
enum ListItrDirection direction
The direction of the iterator.
List * list
A pointer to the List this is iterating through.
A single entry in a List.
void * data
Pointer to generic data stored in this node.
ListNode * prev
The previous ListNode in the associated List, NULL if at the head of the list.
ListNode * next
The next ListNode in the associated List, NULL if at the tail of the list.
ListNode * head
The first entry in the list.
ListNode * tail
The last entry in the list.
int len
Number of elements in list.