diff options
Diffstat (limited to 'src/string_list.c')
-rw-r--r-- | src/string_list.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/string_list.c b/src/string_list.c index b39ecd6f..8a63cc3c 100644 --- a/src/string_list.c +++ b/src/string_list.c @@ -30,6 +30,7 @@ void string_list_destroy(string_list *sl) { assert(sl != NULL); + /* Free contained string */ if (sl->s) { string_free(sl->s); sl->s = NULL; @@ -38,3 +39,14 @@ void string_list_destroy(string_list *sl) /* We do NOT free the rest of the list. */ sl->next = NULL; } + +/** + * Append a string to a string_list. + */ +void string_list_append(string_list **slist, cptr s) +{ + string_list *e = malloc(sizeof(string_list)); + string_list_init(e, s); + + sglib_string_list_add(slist, e); +} |