summaryrefslogtreecommitdiff
path: root/include/list.h
diff options
context:
space:
mode:
authorIan Fan <[email protected]>2018-12-08 22:52:29 +0000
committerIan Fan <[email protected]>2018-12-09 00:37:50 +0000
commit19e831ed3da2aba75d56e46c57967bcc60442d57 (patch)
treeedaa5855087f9d6f257c5c6dcd5eda0c4cc55b02 /include/list.h
parent0c3f0dfd16b73f659c4eddd42ae9467bfc25a19c (diff)
list.c: Remove list_foreach
Most occurrences have been replaced by `free_flat_list` which has been moved from stringop.c to list.c. The rest have been replaced by for loops.
Diffstat (limited to 'include/list.h')
-rw-r--r--include/list.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/include/list.h b/include/list.h
index 03851a82..70af49f6 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 free_flat_list(list_t *list);
#endif