39 MCL_DEBUG_ENTRY(
"mcl_list_t *list = <%p>, void *data = <%p>", list, data);
49 new_node->
data = data;
52 MCL_VERBOSE(
"new_node initialized and its data assigned to the received one. Node's data address = <%p>", (
void *) new_node->
data);
57 list->
head = new_node;
58 list->
last = new_node;
64 list->
last = new_node;
69 MCL_VERBOSE(
"new_node has been added to the list. Current list count = <%d>", list->
count);
80 MCL_DEBUG_ENTRY(
"mcl_list_t *list = <%p>, mcl_list_node_t **node = <%p>", list, node);
121 MCL_DEBUG_ENTRY(
"mcl_list_t *list = <%p>, mcl_list_node_t *node = <%p>", list, node);
140 MCL_VERBOSE(
"This is the only node in list. No need for any connection handling.");
148 MCL_VERBOSE(
"There is node's after this node. Next node's prev is set NULL.");
164 MCL_VERBOSE(
"This is the last node. Previous node's next is set NULL");
172 MCL_VERBOSE(
"node->next and node->prev are not MCL_NULL.");
173 MCL_VERBOSE(
"This is a middle node. prev's next is connected to current next. next's prev is connected to current prev.");
181 if (list->
head == node)
184 MCL_VERBOSE(
"This is the head node. Head pointer updated to the next node");
187 if (list->
last == node)
190 MCL_VERBOSE(
"This is the last node. Last pointer updated to the previous node");
197 MCL_VERBOSE(
"This is the list's current node. Current pointer updated to the next node");
202 MCL_VERBOSE(
"List counter decreased by one. Current count = <%d>", list->
count);
219 MCL_DEBUG_ENTRY(
"mcl_list_t *list = <%p>, mcl_list_node_t *node = <%p>, mcl_list_item_destroy_callback callback = <%p>", list, node, callback);
244 MCL_DEBUG_ENTRY(
"mcl_list_t *list = <%p>, const void *item_to_find = <%p>, mcl_list_compare_callback compare_function = <%p>, void **item = <%p>",
245 list, item_to_find, compare_function, item);
253 current_node = list->
head;
256 mcl_error_t item_exists_in_the_list = compare_function(current_node->
data, item_to_find);
258 if (
MCL_OK == item_exists_in_the_list)
260 *item = current_node->
data;
266 current_node = current_node->
next;
304 MCL_DEBUG_ENTRY(
"mcl_list_t **list = <%p>, mcl_list_item_destroy_callback callback = <%p>", list, callback);
319 callback(&(current_node->
data));
322 node_to_free = current_node;
323 current_node = node_to_free->
next;
#define MCL_FUNCTION_LEAVE_LABEL
mcl_error_t(* mcl_list_compare_callback)(void *reference_item, const void *item_to_compare)
Assert module header file.
There is no element in the list.
#define MCL_DEBUG_ENTRY(...)
void mcl_list_destroy_with_content(mcl_list_t **list, mcl_list_item_destroy_callback callback)
void(* mcl_list_item_destroy_callback)(void **item)
mcl_error_t mcl_list_add(mcl_list_t *list, void *data)
mcl_error_t mcl_list_exist(mcl_list_t *list, const void *item_to_find, mcl_list_compare_callback compare_function, void **item)
#define MCL_ASSERT_CODE_MESSAGE(condition, return_code,...)
mcl_error_t mcl_list_next(mcl_list_t *list, mcl_list_node_t **node)
struct mcl_list_node_t * next
Next node in the list.
mcl_list_node_t * head
Head node of the list.
void mcl_list_reset(mcl_list_t *list)
mcl_error_t mcl_list_remove_with_content(mcl_list_t *list, mcl_list_node_t *node, mcl_list_item_destroy_callback callback)
#define MCL_ASSERT_NOT_NULL(argument, return_variable)
mcl_error_t mcl_list_remove(mcl_list_t *list, mcl_list_node_t *node)
struct mcl_list_node_t * prev
Previous node in the list.
mcl_list_node_t * last
Last node of the list.
void mcl_list_destroy(mcl_list_t **list)
mcl_list_node_t * current
Current node of the list.
mcl_error_t mcl_list_initialize(mcl_list_t **list)
No more space is left to add an additional object.
mcl_size_t count
Node count of the list.
#define MCL_DEBUG_LEAVE(...)
void * data
Data of the node.
Memory module interface header file.