]> git.notmuchmail.org Git - notmuch/blobdiff - lib/messages.c
use EMPTY_STRING in _parent_via_in_reply_to
[notmuch] / lib / messages.c
index 11218648f8c15f86f5a5dd6c5c0ece696577e46a..ba8a9777b0842e4bdf16b5bd879b1bd4c27b04b5 100644 (file)
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see http://www.gnu.org/licenses/ .
+ * along with this program.  If not, see https://www.gnu.org/licenses/ .
  *
  * Author: Carl Worth <cworth@cworth.org>
  */
@@ -42,19 +42,7 @@ _notmuch_message_list_create (const void *ctx)
     return list;
 }
 
-/* Append a single 'node' to the end of 'list'.
- */
-void
-_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'.
- */
+/* Append 'message' to the end of 'list'. */
 void
 _notmuch_message_list_add_message (notmuch_message_list_t *list,
                                   notmuch_message_t *message)
@@ -64,7 +52,17 @@ _notmuch_message_list_add_message (notmuch_message_list_t *list,
     node->message = message;
     node->next = NULL;
 
-    _notmuch_message_list_append (list, node);
+    *(list->tail) = node;
+    list->tail = &node->next;
+}
+
+bool
+_notmuch_message_list_empty (notmuch_message_list_t *list)
+{
+    if (list == NULL)
+       return TRUE;
+
+    return (list->head == NULL);
 }
 
 notmuch_messages_t *
@@ -79,7 +77,7 @@ _notmuch_messages_create (notmuch_message_list_t *list)
     if (unlikely (messages == NULL))
        return NULL;
 
-    messages->is_of_list_type = TRUE;
+    messages->is_of_list_type = true;
     messages->iterator = list->head;
 
     return messages;
@@ -104,7 +102,7 @@ notmuch_bool_t
 notmuch_messages_valid (notmuch_messages_t *messages)
 {
     if (messages == NULL)
-       return FALSE;
+       return false;
 
     if (! messages->is_of_list_type)
        return _notmuch_mset_messages_valid (messages);