NeoMutt  2021-10-29-220-g2b1eec
Teaching an old dog new tricks
DOXYGEN
list.h
Go to the documentation of this file.
1 
24 #ifndef MUTT_LIB_LIST_H
25 #define MUTT_LIB_LIST_H
26 
27 #include <stddef.h>
28 #include <stdbool.h>
29 #include "queue.h"
30 
34 struct ListNode
35 {
36  char *data;
38 };
39 STAILQ_HEAD(ListHead, ListNode);
40 
48 typedef void (*list_free_t)(void **ptr);
49 
50 void mutt_list_clear(struct ListHead *h);
51 bool mutt_list_compare(const struct ListHead *ah, const struct ListHead *bh);
52 struct ListNode *mutt_list_find(const struct ListHead *h, const char *data);
53 void mutt_list_free(struct ListHead *h);
54 void mutt_list_free_type(struct ListHead *h, list_free_t fn);
55 struct ListNode *mutt_list_insert_after(struct ListHead *h, struct ListNode *n, char *s);
56 struct ListNode *mutt_list_insert_head(struct ListHead *h, char *s);
57 struct ListNode *mutt_list_insert_tail(struct ListHead *h, char *s);
58 bool mutt_list_match(const char *s, struct ListHead *h);
59 size_t mutt_list_str_split(struct ListHead *head, const char *src, char sep);
60 
61 #endif /* MUTT_LIB_LIST_H */
struct ListNode * mutt_list_find(const struct ListHead *h, const char *data)
Find a string in a List.
Definition: list.c:102
struct ListNode * mutt_list_insert_head(struct ListHead *h, char *s)
Insert a string at the beginning of a List.
Definition: list.c:45
bool mutt_list_compare(const struct ListHead *ah, const struct ListHead *bh)
Compare two string lists.
Definition: list.c:218
void mutt_list_clear(struct ListHead *h)
Free a list, but NOT its strings.
Definition: list.c:167
size_t mutt_list_str_split(struct ListHead *head, const char *src, char sep)
Split a string into a list using a separator char.
Definition: list.c:247
void(* list_free_t)(void **ptr)
Definition: list.h:48
struct ListNode * mutt_list_insert_after(struct ListHead *h, struct ListNode *n, char *s)
Insert a string after a given ListNode.
Definition: list.c:84
void mutt_list_free(struct ListHead *h)
Free a List AND its strings.
Definition: list.c:122
STAILQ_HEAD(ListHead, ListNode)
struct ListNode * mutt_list_insert_tail(struct ListHead *h, char *s)
Append a string to the end of a List.
Definition: list.c:64
void mutt_list_free_type(struct ListHead *h, list_free_t fn)
Free a List of type.
Definition: list.c:144
bool mutt_list_match(const char *s, struct ListHead *h)
Is the string in the list (see notes)
Definition: list.c:195
A List node for strings.
Definition: list.h:35
char * data
String.
Definition: list.h:36
STAILQ_ENTRY(ListNode) entries
Linked list.