The str_list_destroy function may be called to cleanup memory when
the list is not used anymore and the list itself was not allocated
from the memory pool.
dm_pool_free(mem, list);
return NULL;
}
+
+void str_list_destroy(struct dm_list *list, int deallocate_strings)
+{
+ struct dm_str_list *sl, *tmp_sl;
+
+ dm_list_iterate_items_safe(sl, tmp_sl, list) {
+ dm_list_del(&sl->list);
+ if (deallocate_strings)
+ dm_free((char *)sl->str);
+ dm_free(sl);
+ }
+ dm_free(list);
+}
const struct dm_list *sllold);
char *str_list_to_str(struct dm_pool *mem, const struct dm_list *list, const char *delim);
struct dm_list *str_to_str_list(struct dm_pool *mem, const char *str, const char *delim, int ignore_multiple_delim);
+/* Only for lists which were *not* allocated from the mem pool! */
+void str_list_destroy(struct dm_list *list, int deallocate_strings);
#endif