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 olra.theworths.org (Postfix) with ESMTP id 893B6431FD0
\r
6 for <notmuch@notmuchmail.org>; Sat, 7 Mar 2015 11:25:17 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=2.438 tagged_above=-999 required=5
\r
12 tests=[DNS_FROM_AHBL_RHSBL=2.438] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id UhEWiXOnKj4W for <notmuch@notmuchmail.org>;
\r
16 Sat, 7 Mar 2015 11:25:15 -0800 (PST)
\r
17 Received: from mx.xen14.node3324.gplhost.com (gitolite.debian.net
\r
19 (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id E04D5431FCB
\r
22 for <notmuch@notmuchmail.org>; Sat, 7 Mar 2015 11:25:14 -0800 (PST)
\r
23 Received: from remotemail by mx.xen14.node3324.gplhost.com with local (Exim
\r
24 4.80) (envelope-from <bremner@tesseract.cs.unb.ca>)
\r
25 id 1YUKKv-0004Du-Hs; Sat, 07 Mar 2015 19:24:33 +0000
\r
26 Received: (nullmailer pid 28725 invoked by uid 1000); Sat, 07 Mar 2015
\r
28 From: David Bremner <david@tethera.net>
\r
29 To: notmuch@notmuchmail.org
\r
30 Subject: [PATCH 3/5] cli/lib: remove most use of deprecated
\r
31 notmuch_query_search_{messages,threads}
\r
32 Date: Sat, 7 Mar 2015 20:23:00 +0100
\r
33 Message-Id: <1425756182-28468-4-git-send-email-david@tethera.net>
\r
34 X-Mailer: git-send-email 2.1.4
\r
35 In-Reply-To: <1425756182-28468-1-git-send-email-david@tethera.net>
\r
36 References: <1425756182-28468-1-git-send-email-david@tethera.net>
\r
37 X-BeenThere: notmuch@notmuchmail.org
\r
38 X-Mailman-Version: 2.1.13
\r
40 List-Id: "Use and development of the notmuch mail system."
\r
41 <notmuch.notmuchmail.org>
\r
42 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
43 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
44 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
45 List-Post: <mailto:notmuch@notmuchmail.org>
\r
46 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
47 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
48 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
49 X-List-Received-Date: Sat, 07 Mar 2015 19:25:17 -0000
\r
51 There two remaining cases in the lib that seem to require more than a
\r
52 simple replacement of the old call, with the new call plus a check of
\r
55 lib/database.cc | 2 ++
\r
56 lib/query.cc | 4 +++-
\r
57 lib/thread.cc | 2 ++
\r
58 notmuch-count.c | 5 +++--
\r
59 notmuch-dump.c | 7 ++++++-
\r
60 notmuch-reply.c | 25 ++++++++++++++++++++++---
\r
61 notmuch-search.c | 21 +++++++++++++++------
\r
62 notmuch-show.c | 13 ++++++++++---
\r
63 notmuch-tag.c | 8 +++++++-
\r
64 9 files changed, 70 insertions(+), 17 deletions(-)
\r
66 diff --git a/lib/database.cc b/lib/database.cc
\r
67 index 3974e2e..8680963 100644
\r
68 --- a/lib/database.cc
\r
69 +++ b/lib/database.cc
\r
70 @@ -1306,6 +1306,8 @@ notmuch_database_upgrade (notmuch_database_t *notmuch,
\r
71 notmuch_message_t *message;
\r
74 + /* XXX: this should use the _st version, but needs an error
\r
76 for (messages = notmuch_query_search_messages (query);
\r
77 notmuch_messages_valid (messages);
\r
78 notmuch_messages_move_to_next (messages))
\r
79 diff --git a/lib/query.cc b/lib/query.cc
\r
80 index 9279915..1871a81 100644
\r
83 @@ -610,7 +610,9 @@ notmuch_query_count_threads (notmuch_query_t *query)
\r
86 query->sort = NOTMUCH_SORT_UNSORTED;
\r
87 - messages = notmuch_query_search_messages (query);
\r
88 + ret = notmuch_query_search_messages_st (query, &messages);
\r
92 if (messages == NULL)
\r
94 diff --git a/lib/thread.cc b/lib/thread.cc
\r
95 index 9847cf8..c8e58c3 100644
\r
98 @@ -504,6 +504,8 @@ _notmuch_thread_create (void *ctx,
\r
99 * oldest or newest subject is desired. */
\r
100 notmuch_query_set_sort (thread_id_query, NOTMUCH_SORT_OLDEST_FIRST);
\r
102 + /* XXX: this should use the _st version, but it needs an error path
\r
104 for (messages = notmuch_query_search_messages (thread_id_query);
\r
105 notmuch_messages_valid (messages);
\r
106 notmuch_messages_move_to_next (messages))
\r
107 diff --git a/notmuch-count.c b/notmuch-count.c
\r
108 index 6058f7c..d555bf1 100644
\r
109 --- a/notmuch-count.c
\r
110 +++ b/notmuch-count.c
\r
111 @@ -39,10 +39,11 @@ count_files (notmuch_query_t *query)
\r
112 notmuch_messages_t *messages;
\r
113 notmuch_message_t *message;
\r
114 notmuch_filenames_t *filenames;
\r
115 + notmuch_status_t status;
\r
116 unsigned int count = 0;
\r
118 - messages = notmuch_query_search_messages (query);
\r
119 - if (messages == NULL)
\r
120 + status = notmuch_query_search_messages_st (query, &messages);
\r
125 diff --git a/notmuch-dump.c b/notmuch-dump.c
\r
126 index 9c6ad7f..c6154a9 100644
\r
127 --- a/notmuch-dump.c
\r
128 +++ b/notmuch-dump.c
\r
129 @@ -48,8 +48,13 @@ database_dump_file (notmuch_database_t *notmuch, gzFile output,
\r
131 char *buffer = NULL;
\r
132 size_t buffer_size = 0;
\r
133 + notmuch_status_t status;
\r
135 - for (messages = notmuch_query_search_messages (query);
\r
136 + status = notmuch_query_search_messages_st (query, &messages);
\r
138 + return EXIT_FAILURE;
\r
141 notmuch_messages_valid (messages);
\r
142 notmuch_messages_move_to_next (messages)) {
\r
144 diff --git a/notmuch-reply.c b/notmuch-reply.c
\r
145 index 7c1c809..dca4e42 100644
\r
146 --- a/notmuch-reply.c
\r
147 +++ b/notmuch-reply.c
\r
148 @@ -606,8 +606,15 @@ notmuch_reply_format_default(void *ctx,
\r
149 notmuch_messages_t *messages;
\r
150 notmuch_message_t *message;
\r
152 + notmuch_status_t status;
\r
154 - for (messages = notmuch_query_search_messages (query);
\r
155 + status = notmuch_query_search_messages_st (query, &messages);
\r
157 + fprintf (stderr, "Error: %s.\n", notmuch_status_to_string (status));
\r
162 notmuch_messages_valid (messages);
\r
163 notmuch_messages_move_to_next (messages))
\r
165 @@ -656,7 +663,12 @@ notmuch_reply_format_sprinter(void *ctx,
\r
169 - messages = notmuch_query_search_messages (query);
\r
170 + status = notmuch_query_search_messages_st (query, &messages);
\r
172 + fprintf (stderr, "Error: %s.\n", notmuch_status_to_string (status));
\r
176 message = notmuch_messages_get (messages);
\r
177 if (mime_node_open (ctx, message, &(params->crypto), &node) != NOTMUCH_STATUS_SUCCESS)
\r
179 @@ -698,8 +710,15 @@ notmuch_reply_format_headers_only(void *ctx,
\r
180 notmuch_message_t *message;
\r
181 const char *in_reply_to, *orig_references, *references;
\r
182 char *reply_headers;
\r
183 + notmuch_status_t status;
\r
185 - for (messages = notmuch_query_search_messages (query);
\r
186 + status = notmuch_query_search_messages_st (query, &messages);
\r
188 + fprintf (stderr, "Error: %s.\n", notmuch_status_to_string (status));
\r
193 notmuch_messages_valid (messages);
\r
194 notmuch_messages_move_to_next (messages))
\r
196 diff --git a/notmuch-search.c b/notmuch-search.c
\r
197 index a591d45..20feda4 100644
\r
198 --- a/notmuch-search.c
\r
199 +++ b/notmuch-search.c
\r
200 @@ -111,6 +111,7 @@ do_search_threads (search_context_t *ctx)
\r
201 sprinter_t *format = ctx->format;
\r
204 + notmuch_status_t status;
\r
206 if (ctx->offset < 0) {
\r
207 ctx->offset += notmuch_query_count_threads (ctx->query);
\r
208 @@ -118,9 +119,11 @@ do_search_threads (search_context_t *ctx)
\r
212 - threads = notmuch_query_search_threads (ctx->query);
\r
213 - if (threads == NULL)
\r
214 + status = notmuch_query_search_threads_st (ctx->query, &threads);
\r
216 + fprintf (stderr, "Error: %s.\n", notmuch_status_to_string (status));
\r
220 format->begin_list (format);
\r
222 @@ -412,6 +415,7 @@ do_search_messages (search_context_t *ctx)
\r
223 notmuch_filenames_t *filenames;
\r
224 sprinter_t *format = ctx->format;
\r
226 + notmuch_status_t status;
\r
228 if (ctx->offset < 0) {
\r
229 ctx->offset += notmuch_query_count_messages (ctx->query);
\r
230 @@ -419,9 +423,11 @@ do_search_messages (search_context_t *ctx)
\r
234 - messages = notmuch_query_search_messages (ctx->query);
\r
235 - if (messages == NULL)
\r
236 + status = notmuch_query_search_messages_st (ctx->query, &messages);
\r
238 + fprintf (stderr, "Error: %s.\n", notmuch_status_to_string (status));
\r
242 format->begin_list (format);
\r
244 @@ -508,9 +514,12 @@ do_search_tags (const search_context_t *ctx)
\r
245 if (strcmp (notmuch_query_get_query_string (query), "*") == 0) {
\r
246 tags = notmuch_database_get_all_tags (notmuch);
\r
248 - messages = notmuch_query_search_messages (query);
\r
249 - if (messages == NULL)
\r
250 + notmuch_status_t status;
\r
251 + status = notmuch_query_search_messages_st (query, &messages);
\r
253 + fprintf (stderr, "Error: %s.\n", notmuch_status_to_string (status));
\r
257 tags = notmuch_messages_collect_tags (messages);
\r
259 diff --git a/notmuch-show.c b/notmuch-show.c
\r
260 index d416fbd..af8741d 100644
\r
261 --- a/notmuch-show.c
\r
262 +++ b/notmuch-show.c
\r
263 @@ -988,7 +988,12 @@ do_show_single (void *ctx,
\r
267 - messages = notmuch_query_search_messages (query);
\r
268 + status = notmuch_query_search_messages_st (query, &messages);
\r
270 + fprintf (stderr, "Error: %s.\n", notmuch_status_to_string (status));
\r
274 message = notmuch_messages_get (messages);
\r
276 if (message == NULL) {
\r
277 @@ -1015,9 +1020,11 @@ do_show (void *ctx,
\r
278 notmuch_messages_t *messages;
\r
279 notmuch_status_t status, res = NOTMUCH_STATUS_SUCCESS;
\r
281 - threads = notmuch_query_search_threads (query);
\r
283 + status= notmuch_query_search_threads_st (query, &threads);
\r
285 + fprintf (stderr, "Error: %s.\n", notmuch_status_to_string (status));
\r
289 sp->begin_list (sp);
\r
291 diff --git a/notmuch-tag.c b/notmuch-tag.c
\r
292 index 5b2f1e4..dcaca43 100644
\r
293 --- a/notmuch-tag.c
\r
294 +++ b/notmuch-tag.c
\r
295 @@ -97,6 +97,8 @@ tag_query (void *ctx, notmuch_database_t *notmuch, const char *query_string,
\r
296 notmuch_query_t *query;
\r
297 notmuch_messages_t *messages;
\r
298 notmuch_message_t *message;
\r
299 + notmuch_status_t status;
\r
301 int ret = NOTMUCH_STATUS_SUCCESS;
\r
303 if (! (flags & TAG_FLAG_REMOVE_ALL)) {
\r
304 @@ -119,7 +121,11 @@ tag_query (void *ctx, notmuch_database_t *notmuch, const char *query_string,
\r
305 /* tagging is not interested in any special sort order */
\r
306 notmuch_query_set_sort (query, NOTMUCH_SORT_UNSORTED);
\r
308 - for (messages = notmuch_query_search_messages (query);
\r
309 + status = notmuch_query_search_messages_st (query, &messages);
\r
314 notmuch_messages_valid (messages) && ! interrupted;
\r
315 notmuch_messages_move_to_next (messages)) {
\r
316 message = notmuch_messages_get (messages);
\r