-_notmuch_messages_add_message (notmuch_messages_t *messages,
- notmuch_message_t *message)
+_notmuch_message_list_append (notmuch_message_list_t *list,
+ notmuch_message_node_t *node)
+{
+ *(list->tail) = node;
+ list->tail = &node->next;
+}
+
+/* Allocate a new node for 'message' and append it to the end of
+ * 'list'.
+ */
+void
+_notmuch_message_list_add_message (notmuch_message_list_t *list,
+ notmuch_message_t *message)
+{
+ notmuch_message_node_t *node = talloc (list, notmuch_message_node_t);
+
+ node->message = message;
+ node->next = NULL;
+
+ _notmuch_message_list_append (list, node);
+}
+
+notmuch_messages_t *
+_notmuch_messages_create (notmuch_message_list_t *list)