diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/list.h | 7 | ||||
-rw-r--r-- | include/stringop.h | 3 |
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 { | |||
9 | 9 | ||
10 | list_t *create_list(void); | 10 | list_t *create_list(void); |
11 | void list_free(list_t *list); | 11 | void list_free(list_t *list); |
12 | void list_foreach(list_t *list, void (*callback)(void* item)); | ||
13 | void list_add(list_t *list, void *item); | 12 | void list_add(list_t *list, void *item); |
14 | void list_insert(list_t *list, int index, void *item); | 13 | void list_insert(list_t *list, int index, void *item); |
15 | void list_del(list_t *list, int index); | 14 | 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)); | |||
27 | void list_swap(list_t *list, int src, int dest); | 26 | void list_swap(list_t *list, int src, int dest); |
28 | // move item to end of list | 27 | // move item to end of list |
29 | void list_move_to_end(list_t *list, void *item); | 28 | void list_move_to_end(list_t *list, void *item); |
29 | |||
30 | /* Calls `free` for each item in the list, then frees the list. | ||
31 | * Do not use this to free lists of primitives or items that require more | ||
32 | * complicated deallocation code. | ||
33 | */ | ||
34 | void list_free_items_and_destroy(list_t *list); | ||
30 | #endif | 35 | #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); | |||
17 | // strcmp that also handles null pointers. | 17 | // strcmp that also handles null pointers. |
18 | int lenient_strcmp(char *a, char *b); | 18 | int lenient_strcmp(char *a, char *b); |
19 | 19 | ||
20 | // Simply split a string with delims, free with `free_flat_list` | 20 | // Simply split a string with delims, free with `list_free_items_and_destroy` |
21 | list_t *split_string(const char *str, const char *delims); | 21 | list_t *split_string(const char *str, const char *delims); |
22 | void free_flat_list(list_t *list); | ||
23 | 22 | ||
24 | // Splits an argument string, keeping quotes intact | 23 | // Splits an argument string, keeping quotes intact |
25 | char **split_args(const char *str, int *argc); | 24 | char **split_args(const char *str, int *argc); |