1 Return-Path: <jani@nikula.org>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by arlo.cworth.org (Postfix) with ESMTP id 4D48E6DE1435
\r
6 for <notmuch@notmuchmail.org>; Mon, 5 Oct 2015 11:26:00 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org
\r
11 X-Spam-Status: No, score=-0.159 tagged_above=-999 required=5
\r
12 tests=[AWL=-0.183, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01,
\r
13 RCVD_IN_MSPIKE_WL=-0.01, URIBL_SBL=0.644, URIBL_SBL_A=0.1]
\r
15 Received: from arlo.cworth.org ([127.0.0.1])
\r
16 by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)
\r
17 with ESMTP id G5bGjc4XXoRD for <notmuch@notmuchmail.org>;
\r
18 Mon, 5 Oct 2015 11:25:58 -0700 (PDT)
\r
19 Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com
\r
21 by arlo.cworth.org (Postfix) with ESMTPS id CF5546DE02D6
\r
22 for <notmuch@notmuchmail.org>; Mon, 5 Oct 2015 11:25:57 -0700 (PDT)
\r
23 Received: by wicfx3 with SMTP id fx3so126874370wic.0
\r
24 for <notmuch@notmuchmail.org>; Mon, 05 Oct 2015 11:25:56 -0700 (PDT)
\r
25 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
\r
26 d=1e100.net; s=20130820;
\r
27 h=x-gm-message-state:from:to:subject:in-reply-to:references
\r
28 :user-agent:date:message-id:mime-version:content-type;
\r
29 bh=sSbqIVc97hhuE0tZ1gNwZqnJb73F2sb18lkuzugx2+I=;
\r
30 b=akx4w0czGWQu7fQ8fVSGitxUklY/nGt/yw5/ZKtpNVaxIaRqFkpYqZ4WdSDpb/Q8dc
\r
31 mDV8KxtAhW32Eomw1ClNZRfxVmk5DDB4Qg0LU3wo2xPFhbB1PxOuAAvVcWiCkSY48QlX
\r
32 ky1DmLW90flMqE43ZBdhKnt3+B3rR4hgCQ1BjnK/pdOGSZn9q9Rpo42tqC9OKaoxu1jW
\r
33 u4dRIZ/Msa2sV/jxEn3Pl3946jTr+tPXo8x/YpH7LeIBFNcny10ZuleBQxted4xixM0M
\r
34 /iS6XBZrs8MlWYK1tzJhir/pMRDafyP0blatTO5ZoTzDm+pgY26+JAHLjKjbfJwVJ1JL
\r
37 ALoCoQl7KBseaUCcvVEPHyRVDu7m2nZW/fHYI9WWxbVLLyB3QMYQHEalCV+tlfxJthdtXN2jmlxZ
\r
38 X-Received: by 10.194.117.164 with SMTP id kf4mr31923880wjb.9.1444069556218;
\r
39 Mon, 05 Oct 2015 11:25:56 -0700 (PDT)
\r
40 Received: from localhost (mobile-access-bcee9f-54.dhcp.inet.fi.
\r
42 by smtp.gmail.com with ESMTPSA id cc8sm14758342wjc.46.2015.10.05.11.25.55
\r
43 (version=TLSv1/SSLv3 cipher=OTHER);
\r
44 Mon, 05 Oct 2015 11:25:55 -0700 (PDT)
\r
45 From: Jani Nikula <jani@nikula.org>
\r
46 To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org
\r
47 Subject: Re: [Patch v4 4/9] cli: update to use new count API
\r
48 In-Reply-To: <1443367923-11867-5-git-send-email-david@tethera.net>
\r
49 References: <1443367923-11867-1-git-send-email-david@tethera.net>
\r
50 <1443367923-11867-5-git-send-email-david@tethera.net>
\r
51 User-Agent: Notmuch/0.20.2+101~g7b7dadb (http://notmuchmail.org) Emacs/24.4.1
\r
52 (x86_64-pc-linux-gnu)
\r
53 Date: Mon, 05 Oct 2015 21:25:29 +0300
\r
54 Message-ID: <87egh9895y.fsf@nikula.org>
\r
56 Content-Type: text/plain
\r
57 X-BeenThere: notmuch@notmuchmail.org
\r
58 X-Mailman-Version: 2.1.18
\r
60 List-Id: "Use and development of the notmuch mail system."
\r
61 <notmuch.notmuchmail.org>
\r
62 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
63 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
64 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>
\r
65 List-Post: <mailto:notmuch@notmuchmail.org>
\r
66 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
67 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
68 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
69 X-List-Received-Date: Mon, 05 Oct 2015 18:26:00 -0000
\r
71 On Sun, 27 Sep 2015, David Bremner <david@tethera.net> wrote:
\r
72 > Essentially replace each call to notmuch_count_* with the corresponding
\r
73 > _st call, followed by print_status_query.
\r
78 > notmuch-count.c | 12 ++++++++++--
\r
79 > notmuch-reply.c | 7 ++++++-
\r
80 > notmuch-search.c | 16 ++++++++++++++--
\r
81 > notmuch-show.c | 7 ++++++-
\r
82 > 4 files changed, 36 insertions(+), 6 deletions(-)
\r
84 > diff --git a/notmuch-count.c b/notmuch-count.c
\r
85 > index be3e236..0b6e6f5 100644
\r
86 > --- a/notmuch-count.c
\r
87 > +++ b/notmuch-count.c
\r
88 > @@ -75,9 +75,11 @@ print_count (notmuch_database_t *notmuch, const char *query_str,
\r
89 > notmuch_query_t *query;
\r
92 > + unsigned int ucount;
\r
93 > unsigned long revision;
\r
96 > + notmuch_status_t status;
\r
98 > query = notmuch_query_create (notmuch, query_str);
\r
99 > if (query == NULL) {
\r
100 > @@ -90,10 +92,16 @@ print_count (notmuch_database_t *notmuch, const char *query_str,
\r
102 > switch (output) {
\r
103 > case OUTPUT_MESSAGES:
\r
104 > - printf ("%u", notmuch_query_count_messages (query));
\r
105 > + status = notmuch_query_count_messages_st (query, &ucount);
\r
106 > + if (print_status_query ("notmuch count", query, status))
\r
108 > + printf ("%u", ucount);
\r
110 > case OUTPUT_THREADS:
\r
111 > - printf ("%u", notmuch_query_count_threads (query));
\r
112 > + status = notmuch_query_count_threads_st (query, &ucount);
\r
113 > + if (print_status_query ("notmuch count", query, status))
\r
115 > + printf ("%u", ucount);
\r
117 > case OUTPUT_FILES:
\r
118 > count = count_files (query);
\r
119 > diff --git a/notmuch-reply.c b/notmuch-reply.c
\r
120 > index fd6a1ec..1357142 100644
\r
121 > --- a/notmuch-reply.c
\r
122 > +++ b/notmuch-reply.c
\r
123 > @@ -655,9 +655,14 @@ notmuch_reply_format_sprinter(void *ctx,
\r
124 > notmuch_messages_t *messages;
\r
125 > notmuch_message_t *message;
\r
126 > mime_node_t *node;
\r
127 > + unsigned count;
\r
128 > notmuch_status_t status;
\r
130 > - if (notmuch_query_count_messages (query) != 1) {
\r
131 > + status = notmuch_query_count_messages_st (query, &count);
\r
132 > + if (print_status_query ("notmuch reply", query, status))
\r
135 > + if (count != 1) {
\r
136 > fprintf (stderr, "Error: search term did not match precisely one message.\n");
\r
139 > diff --git a/notmuch-search.c b/notmuch-search.c
\r
140 > index 44e582c..6d08c25 100644
\r
141 > --- a/notmuch-search.c
\r
142 > +++ b/notmuch-search.c
\r
143 > @@ -121,7 +121,13 @@ do_search_threads (search_context_t *ctx)
\r
144 > notmuch_status_t status;
\r
146 > if (ctx->offset < 0) {
\r
147 > - ctx->offset += notmuch_query_count_threads (ctx->query);
\r
148 > + unsigned count;
\r
149 > + notmuch_status_t status;
\r
150 > + status = notmuch_query_count_threads_st (ctx->query, &count);
\r
151 > + if (print_status_query ("notmuch search", ctx->query, status))
\r
154 > + ctx->offset += count;
\r
155 > if (ctx->offset < 0)
\r
158 > @@ -521,7 +527,13 @@ do_search_messages (search_context_t *ctx)
\r
159 > notmuch_status_t status;
\r
161 > if (ctx->offset < 0) {
\r
162 > - ctx->offset += notmuch_query_count_messages (ctx->query);
\r
163 > + unsigned count;
\r
164 > + notmuch_status_t status;
\r
165 > + status = notmuch_query_count_messages_st (ctx->query, &count);
\r
166 > + if (print_status_query ("notmuch search", ctx->query, status))
\r
169 > + ctx->offset += count;
\r
170 > if (ctx->offset < 0)
\r
173 > diff --git a/notmuch-show.c b/notmuch-show.c
\r
174 > index e054808..5a83c60 100644
\r
175 > --- a/notmuch-show.c
\r
176 > +++ b/notmuch-show.c
\r
177 > @@ -896,8 +896,13 @@ do_show_single (void *ctx,
\r
178 > notmuch_messages_t *messages;
\r
179 > notmuch_message_t *message;
\r
180 > notmuch_status_t status;
\r
181 > + unsigned int count;
\r
183 > - if (notmuch_query_count_messages (query) != 1) {
\r
184 > + status = notmuch_query_count_messages_st (query, &count);
\r
185 > + if (print_status_query ("notmuch show", query, status))
\r
188 > + if (count != 1) {
\r
189 > fprintf (stderr, "Error: search term did not match precisely one message.\n");
\r
195 > _______________________________________________
\r
196 > notmuch mailing list
\r
197 > notmuch@notmuchmail.org
\r
198 > http://notmuchmail.org/mailman/listinfo/notmuch
\r