*/
struct ListNode *mutt_list_insert_head(struct ListHead *h, char *s)
{
+ if (!h)
+ return NULL;
+
struct ListNode *np = mutt_mem_calloc(1, sizeof(struct ListNode));
np->data = s;
STAILQ_INSERT_HEAD(h, np, entries);
*/
struct ListNode *mutt_list_insert_tail(struct ListHead *h, char *s)
{
+ if (!h)
+ return NULL;
+
struct ListNode *np = mutt_mem_calloc(1, sizeof(struct ListNode));
np->data = s;
STAILQ_INSERT_TAIL(h, np, entries);
*/
struct ListNode *mutt_list_insert_after(struct ListHead *h, struct ListNode *n, char *s)
{
+ if (!h || !n)
+ return NULL;
+
struct ListNode *np = mutt_mem_calloc(1, sizeof(struct ListNode));
np->data = s;
STAILQ_INSERT_AFTER(h, n, np, entries);
*/
struct ListNode *mutt_list_find(const struct ListHead *h, const char *data)
{
+ if (!h)
+ return NULL;
+
struct ListNode *np = NULL;
STAILQ_FOREACH(np, h, entries)
{
*/
void mutt_list_free(struct ListHead *h)
{
+ if (!h)
+ return;
+
struct ListNode *np = STAILQ_FIRST(h), *next = NULL;
while (np)
{
*/
void mutt_list_clear(struct ListHead *h)
{
+ if (!h)
+ return;
+
struct ListNode *np = STAILQ_FIRST(h), *next = NULL;
while (np)
{
*/
bool mutt_list_match(const char *s, struct ListHead *h)
{
+ if (!h)
+ return false;
+
struct ListNode *np = NULL;
STAILQ_FOREACH(np, h, entries)
{
*/
bool mutt_list_compare(const struct ListHead *ah, const struct ListHead *bh)
{
+ if (!ah || !bh)
+ return false;
+
struct ListNode *a = STAILQ_FIRST(ah);
struct ListNode *b = STAILQ_FIRST(bh);