aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRyan Dwyer <RyanDwyer@users.noreply.github.com>2018-12-09 21:50:19 +1000
committerGitHub <noreply@github.com>2018-12-09 21:50:19 +1000
commitb61a936c8060bc4ac4320a5f76fd98b5042e5e41 (patch)
tree279a5554686d6e862282c943bda50787b69711e1 /include
parente7efa0e27b7bf44217d7f147281d463708d2dfc9 (diff)
parent98c1e19466c0d83c8e1ca86eda5b273eda7eff3c (diff)
Merge pull request #3271 from ianyfan/list-cleanup
list.c: Remove list_foreach
Diffstat (limited to 'include')
-rw-r--r--include/list.h7
-rw-r--r--include/stringop.h3
2 files changed, 7 insertions, 3 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
diff --git a/include/stringop.h b/include/stringop.h
index 919e605c..d1bfa29d 100644
--- a/include/stringop.h
+++ b/include/stringop.h
@@ -17,9 +17,8 @@ char *lenient_strncat(char *dest, const char *src, size_t len);
// strcmp that also handles null pointers.
int lenient_strcmp(char *a, char *b);
-// Simply split a string with delims, free with `free_flat_list`
+// Simply split a string with delims, free with `list_free_items_and_destroy`
list_t *split_string(const char *str, const char *delims);
-void free_flat_list(list_t *list);
// Splits an argument string, keeping quotes intact
char **split_args(const char *str, int *argc);