X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=lib-lib%2Flist.h;h=4f54d32432d15db1ff70f1f5b5981175819afbc0;hp=918eff8a42ede215730b26fe743fc5f89f4078f6;hb=6d838d9aef36d95fa439b3f7cc06d4e81c8581bd;hpb=108f3c7ab59844591f7540347914ea57be5245e2 diff --git a/lib-lib/list.h b/lib-lib/list.h index 918eff8..4f54d32 100644 --- a/lib-lib/list.h +++ b/lib-lib/list.h @@ -25,9 +25,6 @@ #ifndef MUTT_LIB_LIB_LIST_H #define MUTT_LIB_LIB_LIST_H -#include "mem.h" -#include "str.h" - #define DO_SLIST(type, prefix, dtor) \ static inline type *prefix##_list_pop(type **list) { \ if (*list) { \ @@ -54,6 +51,13 @@ 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) { \ @@ -82,7 +86,11 @@ DO_DELETE(string_list_t, string_item); DO_SLIST(string_list_t, string, string_item_delete); string_list_t *string_list_dup(const string_list_t *); +int string_list_contains(const string_list_t *, const char *, const char *); +void string_list_add(string_list_t **, const char *); +void string_list_remove(string_list_t **l, const char *str); +/* FIXME: b0rken API's, replace that at any cost */ /* add an element to a list */ string_list_t *mutt_add_list_n(string_list_t*, const void*, size_t len); static inline string_list_t *mutt_add_list(string_list_t *head, const char *data) { @@ -90,6 +98,4 @@ static inline string_list_t *mutt_add_list(string_list_t *head, const char *data return mutt_add_list_n(head, data, len ? len + 1 : 0); } - - #endif /* MUTT_LIB_LIB_LIST_H */