diff options
Diffstat (limited to 'src/string_list.cc')
-rw-r--r-- | src/string_list.cc | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/src/string_list.cc b/src/string_list.cc deleted file mode 100644 index 41a1feaf..00000000 --- a/src/string_list.cc +++ /dev/null @@ -1,55 +0,0 @@ -#include "string_list.h" - -int compare_string_list(string_list *a, string_list *b) -{ - if (a == b) - { - return 0; - } - - return strcmp(a->s, b->s); -} - -SGLIB_DEFINE_LIST_FUNCTIONS(string_list, compare_string_list, next); - -/* - * Initialize a string_list value. Copies the input string. - */ -void string_list_init(string_list *sl, cptr s) -{ - assert(sl != NULL); - - sl->s = nullptr; - if (s) - { - sl->s = strdup(s); - } - - sl->next = NULL; -} - -/* - * Destroy string_value. - */ -void string_list_destroy(string_list *sl) -{ - assert(sl != NULL); - - /* Free contained string */ - free(sl->s); - sl->s = NULL; - - /* 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 = new string_list; - string_list_init(e, s); - - sglib_string_list_add(slist, e); -} |