From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id VcsRNlcFCl/zbgAA0tVLHw (envelope-from ) for ; Sat, 11 Jul 2020 18:30:47 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id KHHBMVcFCl+IHAAAB5/wlQ (envelope-from ) for ; Sat, 11 Jul 2020 18:30:47 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [IPv6:2607:5300:201:3100::1657]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 585F2940D35 for ; Sat, 11 Jul 2020 18:30:47 +0000 (UTC) Received: from [144.217.243.247] (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 4BE87200A4; Sat, 11 Jul 2020 14:30:31 -0400 (EDT) Received: from fethera.tethera.net (fethera.tethera.net [IPv6:2607:5300:60:c5::1]) by mail.notmuchmail.org (Postfix) with ESMTP id A53CA1FCA6 for ; Sat, 11 Jul 2020 14:30:20 -0400 (EDT) Received: by fethera.tethera.net (Postfix, from userid 1001) id 789F8613B0; Sat, 11 Jul 2020 14:30:20 -0400 (EDT) Received: (nullmailer pid 1594892 invoked by uid 1000); Sat, 11 Jul 2020 18:30:15 -0000 From: David Bremner To: notmuch@notmuchmail.org Cc: David Bremner Subject: [PATCH 4/5] lib/thread: replace use of deprecated notmuch_message_get_flag Date: Sat, 11 Jul 2020 15:30:07 -0300 Message-Id: <20200711183008.1593624-5-david@tethera.net> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200711183008.1593624-1-david@tethera.net> References: <20200711183008.1593624-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: FOVPNCVBI4LWEYTKXX756NCA7H7MXAJF X-Message-ID-Hash: FOVPNCVBI4LWEYTKXX756NCA7H7MXAJF X-MailFrom: bremner@tethera.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Spam-Score: 0.03 X-TUID: 3XyoibaDNx3+ This adds one more reason why _notmuch_thread_create might return NULL, but those were not previously enumerated, so no promises are broken. --- lib/thread.cc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/thread.cc b/lib/thread.cc index 6073e45c..17346008 100644 --- a/lib/thread.cc +++ b/lib/thread.cc @@ -351,14 +351,16 @@ _thread_set_subject_from_message (notmuch_thread_t *thread, /* Add a message to this thread which is known to match the original * search specification. The 'sort' parameter controls whether the * oldest or newest matching subject is applied to the thread as a - * whole. */ -static void + * whole. Returns 0 on success. + */ +static int _thread_add_matched_message (notmuch_thread_t *thread, notmuch_message_t *message, notmuch_sort_t sort) { time_t date; notmuch_message_t *hashed_message; + notmuch_bool_t is_set; date = notmuch_message_get_date (message); @@ -375,7 +377,9 @@ _thread_add_matched_message (notmuch_thread_t *thread, _thread_set_subject_from_message (thread, message); } - if (! notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED)) + if (notmuch_message_get_flag_st (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED, &is_set)) + return -1; + if (! is_set) thread->matched_messages++; if (g_hash_table_lookup_extended (thread->message_hash, @@ -386,6 +390,7 @@ _thread_add_matched_message (notmuch_thread_t *thread, } _thread_add_matched_author (thread, _notmuch_message_get_author (hashed_message)); + return 0; } static bool @@ -625,7 +630,10 @@ _notmuch_thread_create (void *ctx, if ( _notmuch_doc_id_set_contains (match_set, doc_id)) { _notmuch_doc_id_set_remove (match_set, doc_id); - _thread_add_matched_message (thread, message, sort); + if (_thread_add_matched_message (thread, message, sort)) { + thread = NULL; + goto DONE; + } } _notmuch_message_close (message); -- 2.27.0