+#define DO_SLIST(type, prefix, dtor) \
+ static inline type *prefix##_list_pop(type **list) { \
+ if (*list) { \
+ type *res = *list; \
+ *list = res->next; \
+ res->next = NULL; \
+ return res; \
+ } \
+ return NULL; \
+ } \
+ static inline void prefix##_list_push(type **list, type *item) { \
+ item->next = *list; \
+ *list = item; \
+ } \
+ \
+ static inline type **prefix##_list_last(type **list) { \
+ while (*list) { \
+ list = &(*list)->next; \
+ } \
+ return list; \
+ } \
+ \
+ static inline type **prefix##_list_append(type **list, type *item) { \
+ list = prefix##_list_last(list); \
+ *list = item; \
+ return list; \
+ } \
+ static inline type *prefix##_list_rev(type *list) { \
+ type *l = NULL; \
+ while (list) { \
+ prefix##_list_push(&l, prefix##_list_pop(&list)); \
+ } \
+ return l; \
+ } \
+ \
+ static inline type **prefix##_list_init(type **list) { \
+ *list = NULL; \
+ return list; \
+ } \
+ static inline void prefix##_list_wipe(type **list) { \
+ while (*list) { \
+ type *item = prefix##_list_pop(list); \
+ dtor(&item); \
+ } \
+ } \
+
+
+typedef struct string_list_t {
+ struct string_list_t *next;