Refactoring head_list and tail_list

Simplifying head and tail list. Adding delete_node() to list API.
This commit is contained in:
Michael Tryby
2019-04-11 10:45:22 -04:00
parent af87edbafe
commit 3f37fdbff4
3 changed files with 34 additions and 46 deletions

View File

@@ -59,11 +59,17 @@ void append_list(list_t *list, void *element);
*/
int size_list(list_t *list);
/**
@brief Returns pointer to list node's data.
*/
void *get_data(list_node_t *lnode);
/**
@brief Frees memory associated with a list node.
*/
void delete_node(list_t *list, list_node_t *lnode);
/**
@brief Calls the supplied iterator function with the data element of each
@@ -74,12 +80,12 @@ void for_each_list(list_t *list, listIterator iterator);
/**
@brief Returns the head of the list (optionally removing it at the same time).
*/
void *head_list(list_t *list, bool removeFromList);
list_node_t *head_list(list_t *list, bool removeFromList);
/**
@brief Returns the tail of the list.
*/
void *tail_list(list_t *list);
list_node_t *tail_list(list_t *list);
/**