From: David Bremner Date: Sun, 27 Sep 2015 15:32:02 +0000 (+2100) Subject: [Patch v4 8/9] lib: migrate thread.cc to new query_search API X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c1df27c0382a50981242f9bcad453cf4cf92b148;p=notmuch-archives.git [Patch v4 8/9] lib: migrate thread.cc to new query_search API --- diff --git a/e4/13c3813efd034190e97ed26478e842f5ed0298 b/e4/13c3813efd034190e97ed26478e842f5ed0298 new file mode 100644 index 000000000..45ccbf62d --- /dev/null +++ b/e4/13c3813efd034190e97ed26478e842f5ed0298 @@ -0,0 +1,82 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id A6BAA6DE1413 + for ; Sun, 27 Sep 2015 08:35:25 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: 0.108 +X-Spam-Level: +X-Spam-Status: No, score=0.108 tagged_above=-999 required=5 tests=[AWL=0.108] + autolearn=disabled +Received: from arlo.cworth.org ([127.0.0.1]) + by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id LOEeGvb0ryGC for ; + Sun, 27 Sep 2015 08:35:24 -0700 (PDT) +Received: from gitolite.debian.net (gitolite.debian.net [87.98.215.224]) + by arlo.cworth.org (Postfix) with ESMTPS id E4EFA6DE14FD + for ; Sun, 27 Sep 2015 08:35:23 -0700 (PDT) +Received: from remotemail by gitolite.debian.net with local (Exim 4.80) + (envelope-from ) + id 1ZgDyM-0008FV-2s; Sun, 27 Sep 2015 15:34:42 +0000 +Received: (nullmailer pid 11945 invoked by uid 1000); Sun, 27 Sep 2015 + 15:32:11 -0000 +From: David Bremner +To: notmuch@notmuchmail.org +Subject: [Patch v4 8/9] lib: migrate thread.cc to new query_search API +Date: Sun, 27 Sep 2015 12:32:02 -0300 +Message-Id: <1443367923-11867-9-git-send-email-david@tethera.net> +X-Mailer: git-send-email 2.5.3 +In-Reply-To: <1443367923-11867-1-git-send-email-david@tethera.net> +References: <1443367923-11867-1-git-send-email-david@tethera.net> +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.18 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Sun, 27 Sep 2015 15:35:25 -0000 + +here we rely on thread_id_query being attached to the local talloc +context, so no new cleanup code is needed. +--- + lib/thread.cc | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/lib/thread.cc b/lib/thread.cc +index c8e58c3..0c937d7 100644 +--- a/lib/thread.cc ++++ b/lib/thread.cc +@@ -447,6 +447,7 @@ _notmuch_thread_create (void *ctx, + + notmuch_messages_t *messages; + notmuch_message_t *message; ++ notmuch_status_t status; + + seed_message = _notmuch_message_create (local, notmuch, seed_doc_id, NULL); + if (! seed_message) +@@ -504,9 +505,11 @@ _notmuch_thread_create (void *ctx, + * oldest or newest subject is desired. */ + notmuch_query_set_sort (thread_id_query, NOTMUCH_SORT_OLDEST_FIRST); + +- /* XXX: this should use the _st version, but it needs an error path +- */ +- for (messages = notmuch_query_search_messages (thread_id_query); ++ status = notmuch_query_search_messages_st (thread_id_query, &messages); ++ if (status) ++ goto DONE; ++ ++ for (; + notmuch_messages_valid (messages); + notmuch_messages_move_to_next (messages)) + { +-- +2.5.3 +