diff options
| author | Furkan Sahin <furkan-dev@proton.me> | 2018-12-09 21:50:19 +1000 |
|---|---|---|
| committer | Furkan Sahin <furkan-dev@proton.me> | 2018-12-09 21:50:19 +1000 |
| commit | a0b080b1d26f66ac296388fd97ae6b58d9a0fa1e (patch) | |
| tree | 279a5554686d6e862282c943bda50787b69711e1 /include/list.h | |
| parent | 736a69a558a565b5c1521e9680c1ebbe22630a5c (diff) | |
| parent | 00560ef4351c7957ba975b5406221a2b00862704 (diff) | |
Merge pull request #3271 from ianyfan/list-cleanup
list.c: Remove list_foreach
Diffstat (limited to 'include/list.h')
| -rw-r--r-- | include/list.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/include/list.h b/include/list.h index 03851a82..895f6cc0 100644 --- a/include/list.h +++ b/include/list.h @@ -9,7 +9,6 @@ typedef struct { list_t *create_list(void); void list_free(list_t *list); -void list_foreach(list_t *list, void (*callback)(void* item)); void list_add(list_t *list, void *item); void list_insert(list_t *list, int index, void *item); void list_del(list_t *list, int index); @@ -27,4 +26,10 @@ void list_stable_sort(list_t *list, int compare(const void *a, const void *b)); void list_swap(list_t *list, int src, int dest); // move item to end of list void list_move_to_end(list_t *list, void *item); + +/* Calls `free` for each item in the list, then frees the list. + * Do not use this to free lists of primitives or items that require more + * complicated deallocation code. + */ +void list_free_items_and_destroy(list_t *list); #endif |
