]> git.notmuchmail.org Git - notmuch/commitdiff
lib: add _notmuch_message_list_empty
authorDavid Bremner <david@tethera.net>
Mon, 3 Sep 2018 21:02:25 +0000 (18:02 -0300)
committerDavid Bremner <david@tethera.net>
Thu, 6 Sep 2018 11:07:13 +0000 (08:07 -0300)
There is no public notmuch_message_list_t public interface, so to this
is added to the private API. We use it immediately in thread.cc;
future commits will use it further.

lib/messages.c
lib/notmuch-private.h
lib/thread.cc

index a88f974ff5949bd8d54b886c10949e538ff81909..ba8a9777b0842e4bdf16b5bd879b1bd4c27b04b5 100644 (file)
@@ -56,6 +56,15 @@ _notmuch_message_list_add_message (notmuch_message_list_t *list,
     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 *
 _notmuch_messages_create (notmuch_message_list_t *list)
 {
index 02cc0e09da163251b40547a6e2aea182877f9231..590a3451dfecea9c760ca9ea434296982c0cf6b1 100644 (file)
@@ -477,6 +477,9 @@ struct _notmuch_messages {
 notmuch_message_list_t *
 _notmuch_message_list_create (const void *ctx);
 
+bool
+_notmuch_message_list_empty (notmuch_message_list_t *list);
+
 void
 _notmuch_message_list_add_message (notmuch_message_list_t *list,
                                   notmuch_message_t *message);
index 6d15c49b761b2fc81e36a1f2adfd8e6c07dff4e7..a0ce4be3cd46067ce067681245abe306d9a94837 100644 (file)
@@ -425,7 +425,7 @@ _resolve_thread_relationships (notmuch_thread_t *thread)
     if (first_node) {
        message = first_node->message;
        in_reply_to = _notmuch_message_get_in_reply_to (message);
-       if (thread->toplevel_list->head &&
+       if (! _notmuch_message_list_empty (thread->toplevel_list) &&
            in_reply_to && strlen (in_reply_to) &&
            g_hash_table_lookup_extended (thread->message_hash,
                                          in_reply_to, NULL,