X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=lib%2Fmessages.c;h=ba8a9777b0842e4bdf16b5bd879b1bd4c27b04b5;hp=11218648f8c15f86f5a5dd6c5c0ece696577e46a;hb=ac2146118b83ca08aa6dd1275f65eefaed9fe2c0;hpb=3f9d73884ee7c26797a1528b89e1fe63aadc3271 diff --git a/lib/messages.c b/lib/messages.c index 11218648..ba8a9777 100644 --- a/lib/messages.c +++ b/lib/messages.c @@ -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 */ @@ -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);