1 Return-Path: <bremner@tesseract.cs.unb.ca>
\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 A34956DE15BE
\r
6 for <notmuch@notmuchmail.org>; Sun, 7 Jun 2015 08:03:50 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org
\r
11 X-Spam-Status: No, score=0.226 tagged_above=-999 required=5 tests=[AWL=0.216,
\r
12 T_HEADER_FROM_DIFFERENT_DOMAINS=0.01] autolearn=disabled
\r
13 Received: from arlo.cworth.org ([127.0.0.1])
\r
14 by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id XC06fXIjqJry for <notmuch@notmuchmail.org>;
\r
16 Sun, 7 Jun 2015 08:03:49 -0700 (PDT)
\r
17 Received: from mx.xen14.node3324.gplhost.com (gitolite.debian.net
\r
19 by arlo.cworth.org (Postfix) with ESMTPS id D95D76DE17D3
\r
20 for <notmuch@notmuchmail.org>; Sun, 7 Jun 2015 08:03:48 -0700 (PDT)
\r
21 Received: from remotemail by mx.xen14.node3324.gplhost.com with local (Exim
\r
22 4.80) (envelope-from <bremner@tesseract.cs.unb.ca>)
\r
23 id 1Z1c6M-0004oX-H0; Sun, 07 Jun 2015 15:03:06 +0000
\r
24 Received: (nullmailer pid 7868 invoked by uid 1000); Sun, 07 Jun 2015
\r
26 From: David Bremner <david@tethera.net>
\r
27 To: notmuch@notmuchmail.org
\r
28 Subject: [PATCH 10/10] cli: convert remainder of CLI to
\r
29 n_q_search_{messages,threads}_st
\r
30 Date: Sun, 7 Jun 2015 17:02:03 +0200
\r
31 Message-Id: <1433689323-7520-11-git-send-email-david@tethera.net>
\r
32 X-Mailer: git-send-email 2.1.4
\r
33 In-Reply-To: <1433689323-7520-1-git-send-email-david@tethera.net>
\r
34 References: <1433689323-7520-1-git-send-email-david@tethera.net>
\r
35 X-BeenThere: notmuch@notmuchmail.org
\r
36 X-Mailman-Version: 2.1.18
\r
38 List-Id: "Use and development of the notmuch mail system."
\r
39 <notmuch.notmuchmail.org>
\r
40 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
41 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
42 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>
\r
43 List-Post: <mailto:notmuch@notmuchmail.org>
\r
44 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
45 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
46 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
47 X-List-Received-Date: Sun, 07 Jun 2015 15:03:50 -0000
\r
49 I think it would be no real problem to cut and paste the gdb based
\r
50 error message test from count to the other clients modified here, but
\r
51 I'm not currently convinced it's worth the trouble since the code path
\r
52 being tested is almost the the same, and the tests are relatively
\r
55 notmuch-dump.c | 7 ++++++-
\r
56 notmuch-reply.c | 20 +++++++++++++++++---
\r
57 notmuch-search.c | 15 +++++++++------
\r
58 notmuch-show.c | 10 +++++++---
\r
59 notmuch-tag.c | 8 +++++++-
\r
60 5 files changed, 46 insertions(+), 14 deletions(-)
\r
62 diff --git a/notmuch-dump.c b/notmuch-dump.c
\r
63 index fab22bd..c965a4f 100644
\r
64 --- a/notmuch-dump.c
\r
65 +++ b/notmuch-dump.c
\r
66 @@ -48,8 +48,13 @@ database_dump_file (notmuch_database_t *notmuch, gzFile output,
\r
68 char *buffer = NULL;
\r
69 size_t buffer_size = 0;
\r
70 + notmuch_status_t status;
\r
72 - for (messages = notmuch_query_search_messages (query);
\r
73 + status = notmuch_query_search_messages_st (query, &messages);
\r
74 + if (print_status_query ("notmuch dump", query, status))
\r
75 + return EXIT_FAILURE;
\r
78 notmuch_messages_valid (messages);
\r
79 notmuch_messages_move_to_next (messages)) {
\r
81 diff --git a/notmuch-reply.c b/notmuch-reply.c
\r
82 index 4464741..602bdaa 100644
\r
83 --- a/notmuch-reply.c
\r
84 +++ b/notmuch-reply.c
\r
85 @@ -606,8 +606,13 @@ notmuch_reply_format_default(void *ctx,
\r
86 notmuch_messages_t *messages;
\r
87 notmuch_message_t *message;
\r
89 + notmuch_status_t status;
\r
91 - for (messages = notmuch_query_search_messages (query);
\r
92 + status = notmuch_query_search_messages_st (query, &messages);
\r
93 + if (print_status_query ("notmuch reply", query, status))
\r
97 notmuch_messages_valid (messages);
\r
98 notmuch_messages_move_to_next (messages))
\r
100 @@ -650,13 +655,17 @@ notmuch_reply_format_sprinter(void *ctx,
\r
101 notmuch_messages_t *messages;
\r
102 notmuch_message_t *message;
\r
104 + notmuch_status_t status;
\r
106 if (notmuch_query_count_messages (query) != 1) {
\r
107 fprintf (stderr, "Error: search term did not match precisely one message.\n");
\r
111 - messages = notmuch_query_search_messages (query);
\r
112 + status = notmuch_query_search_messages_st (query, &messages);
\r
113 + if (print_status_query ("notmuch reply", query, status))
\r
116 message = notmuch_messages_get (messages);
\r
117 if (mime_node_open (ctx, message, &(params->crypto), &node) != NOTMUCH_STATUS_SUCCESS)
\r
119 @@ -698,8 +707,13 @@ notmuch_reply_format_headers_only(void *ctx,
\r
120 notmuch_message_t *message;
\r
121 const char *in_reply_to, *orig_references, *references;
\r
122 char *reply_headers;
\r
123 + notmuch_status_t status;
\r
125 + status = notmuch_query_search_messages_st (query, &messages);
\r
126 + if (print_status_query ("notmuch reply", query, status))
\r
129 - for (messages = notmuch_query_search_messages (query);
\r
131 notmuch_messages_valid (messages);
\r
132 notmuch_messages_move_to_next (messages))
\r
134 diff --git a/notmuch-search.c b/notmuch-search.c
\r
135 index b89a17e..9887ebf 100644
\r
136 --- a/notmuch-search.c
\r
137 +++ b/notmuch-search.c
\r
138 @@ -111,6 +111,7 @@ do_search_threads (search_context_t *ctx)
\r
139 sprinter_t *format = ctx->format;
\r
142 + notmuch_status_t status;
\r
144 if (ctx->offset < 0) {
\r
145 ctx->offset += notmuch_query_count_threads (ctx->query);
\r
146 @@ -118,8 +119,8 @@ do_search_threads (search_context_t *ctx)
\r
150 - threads = notmuch_query_search_threads (ctx->query);
\r
151 - if (threads == NULL)
\r
152 + status = notmuch_query_search_threads_st (ctx->query, &threads);
\r
153 + if (print_status_query("notmuch search", ctx->query, status))
\r
156 format->begin_list (format);
\r
157 @@ -412,6 +413,7 @@ do_search_messages (search_context_t *ctx)
\r
158 notmuch_filenames_t *filenames;
\r
159 sprinter_t *format = ctx->format;
\r
161 + notmuch_status_t status;
\r
163 if (ctx->offset < 0) {
\r
164 ctx->offset += notmuch_query_count_messages (ctx->query);
\r
165 @@ -419,8 +421,8 @@ do_search_messages (search_context_t *ctx)
\r
169 - messages = notmuch_query_search_messages (ctx->query);
\r
170 - if (messages == NULL)
\r
171 + status = notmuch_query_search_messages_st (ctx->query, &messages);
\r
172 + if (print_status_query ("notmuch search", ctx->query, status))
\r
175 format->begin_list (format);
\r
176 @@ -508,8 +510,9 @@ do_search_tags (const search_context_t *ctx)
\r
177 if (strcmp (notmuch_query_get_query_string (query), "*") == 0) {
\r
178 tags = notmuch_database_get_all_tags (notmuch);
\r
180 - messages = notmuch_query_search_messages (query);
\r
181 - if (messages == NULL)
\r
182 + notmuch_status_t status;
\r
183 + status = notmuch_query_search_messages_st (query, &messages);
\r
184 + if (print_status_query ("notmuch search", query, status))
\r
187 tags = notmuch_messages_collect_tags (messages);
\r
188 diff --git a/notmuch-show.c b/notmuch-show.c
\r
189 index b80933a..aff39b0 100644
\r
190 --- a/notmuch-show.c
\r
191 +++ b/notmuch-show.c
\r
192 @@ -982,13 +982,17 @@ do_show_single (void *ctx,
\r
194 notmuch_messages_t *messages;
\r
195 notmuch_message_t *message;
\r
196 + notmuch_status_t status;
\r
198 if (notmuch_query_count_messages (query) != 1) {
\r
199 fprintf (stderr, "Error: search term did not match precisely one message.\n");
\r
203 - messages = notmuch_query_search_messages (query);
\r
204 + status = notmuch_query_search_messages_st (query, &messages);
\r
205 + if (print_status_query ("notmuch show", query, status))
\r
208 message = notmuch_messages_get (messages);
\r
210 if (message == NULL) {
\r
211 @@ -1015,8 +1019,8 @@ do_show (void *ctx,
\r
212 notmuch_messages_t *messages;
\r
213 notmuch_status_t status, res = NOTMUCH_STATUS_SUCCESS;
\r
215 - threads = notmuch_query_search_threads (query);
\r
217 + status= notmuch_query_search_threads_st (query, &threads);
\r
218 + if (print_status_query ("notmuch show", query, status))
\r
221 sp->begin_list (sp);
\r
222 diff --git a/notmuch-tag.c b/notmuch-tag.c
\r
223 index 38d99aa..19108d9 100644
\r
224 --- a/notmuch-tag.c
\r
225 +++ b/notmuch-tag.c
\r
226 @@ -97,6 +97,8 @@ tag_query (void *ctx, notmuch_database_t *notmuch, const char *query_string,
\r
227 notmuch_query_t *query;
\r
228 notmuch_messages_t *messages;
\r
229 notmuch_message_t *message;
\r
230 + notmuch_status_t status;
\r
232 int ret = NOTMUCH_STATUS_SUCCESS;
\r
234 if (! (flags & TAG_FLAG_REMOVE_ALL)) {
\r
235 @@ -119,7 +121,11 @@ tag_query (void *ctx, notmuch_database_t *notmuch, const char *query_string,
\r
236 /* tagging is not interested in any special sort order */
\r
237 notmuch_query_set_sort (query, NOTMUCH_SORT_UNSORTED);
\r
239 - for (messages = notmuch_query_search_messages (query);
\r
240 + status = notmuch_query_search_messages_st (query, &messages);
\r
241 + if (print_status_query ("notmuch tag", query, status))
\r
245 notmuch_messages_valid (messages) && ! interrupted;
\r
246 notmuch_messages_move_to_next (messages)) {
\r
247 message = notmuch_messages_get (messages);
\r