move parse.c into rfc822parse.c in the lib-mime as it's what it's about
[apps/madmutt.git] / lib-lib / list.h
index 2e13fca..245a866 100644 (file)
@@ -25,6 +25,8 @@
 #ifndef MUTT_LIB_LIB_LIST_H
 #define MUTT_LIB_LIB_LIST_H
 
+#include "str.h"
+
 typedef struct list_t {
     char *data;
     struct list_t *next;
@@ -57,6 +59,19 @@ static inline LIST *mutt_add_list(LIST *head, const char *data) {
         *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_init(type **list) {                   \
         *list = NULL;                                                        \
         return list;                                                         \