...
1 // This file is under GNU General Public License 3.0
6 #include "dynamic_api.h"
13 typedef struct _stringlist_t {
15 struct _stringlist_t *next;
19 // new_stringlist() - allocate a new stringlist
22 // value (in) initial value as C string or NULL for empty list
25 // pointer to stringlist_t object or NULL if out of memory
28 // the value is being copied before being added to the list
29 // the original string is still being owned by the caller
30 // the "next" pointer of the returned object is NULL
32 DYNAMIC_API stringlist_t *new_stringlist(const char *value);
35 // stringlist_dup() - duplicate a stringlist
38 // src (in) stringlist to copy
41 // pointer to stringlist_t object or NULL if out of memory
43 DYNAMIC_API stringlist_t *stringlist_dup(const stringlist_t *src);
46 // stringlist_add() - add key to stringlist
49 // stringlist (in) stringlist struct or NULL to create a new one
50 // value (in) value as C string
53 // pointer to last element in stringlist or NULL if out of memory
56 // the value is being copied before being added to the list
57 // the original string is still being owned by the caller
59 DYNAMIC_API stringlist_t *stringlist_add(
60 stringlist_t *stringlist,
64 // stringlist_add_unique() - add string to stringlist, if not already there
67 // stringlist (in) stringlist struct or NULL to create a new one
68 // value (in) value as C string
71 // pointer to last element in stringlist or NULL if out of memory
74 // the value is being copied before being added to the list
75 // the original string is still being owned by the caller
77 DYNAMIC_API stringlist_t *stringlist_add_unique(
78 stringlist_t *stringlist,
83 // stringlist_append() - append stringlist to stringlist
86 // stringlist (in) stringlist struct to append to
87 // second (in) stringlist struct to append
90 // pointer to last element in stringlist or NULL if out of memory
91 // or stringpair_list is NULL
94 // all values are being copied before being added to the list
95 // the original values are still being owned by the caller
97 DYNAMIC_API stringlist_t *stringlist_append(
98 stringlist_t *stringlist,
103 // stringlist_length() - get length of stringlist
106 // stringlist (in) stringlist struct to determine length of
109 // length of stringlist in number of elements
111 DYNAMIC_API int stringlist_length(const stringlist_t *stringlist);
114 // stringlist_delete() - delete entry from stringlist
117 // stringlist (in) stringlist struct to delete from
118 // value (in) data to delete
121 // modified stringlist
123 DYNAMIC_API stringlist_t *stringlist_delete(
124 stringlist_t *stringlist,
129 // free_stringlist() - free memory occupied by stringlist
132 // stringlist (in) stringlist to free
134 DYNAMIC_API void free_stringlist(stringlist_t *stringlist);
136 stringlist_t* stringlist_search(stringlist_t* head, const char* value);
138 void dedup_stringlist(stringlist_t* stringlist);