From: David Bremner Date: Sun, 26 Feb 2017 21:21:32 +0000 (-0400) Subject: lib: replace deprecated n_q_search_messages with status returning version X-Git-Tag: 0.25_rc0~96 X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=commitdiff_plain;h=86cbd215eb67d7b996c977352a50e70c101cb641 lib: replace deprecated n_q_search_messages with status returning version This function was deprecated in notmuch 0.21. We re-use the name for a status returning version, and deprecate the _st name. --- diff --git a/bindings/python/notmuch/query.py b/bindings/python/notmuch/query.py index 3419f626..a91bb740 100644 --- a/bindings/python/notmuch/query.py +++ b/bindings/python/notmuch/query.py @@ -164,9 +164,9 @@ class Query(object): return Threads(threads_p, self) """notmuch_query_search_messages_st""" - _search_messages_st = nmlib.notmuch_query_search_messages_st - _search_messages_st.argtypes = [NotmuchQueryP, POINTER(NotmuchMessagesP)] - _search_messages_st.restype = c_uint + _search_messages = nmlib.notmuch_query_search_messages + _search_messages.argtypes = [NotmuchQueryP, POINTER(NotmuchMessagesP)] + _search_messages.restype = c_uint def search_messages(self): """Filter messages according to the query and return @@ -177,7 +177,7 @@ class Query(object): """ self._assert_query_is_initialized() msgs_p = NotmuchMessagesP() # == NULL - status = Query._search_messages_st(self._query, byref(msgs_p)) + status = Query._search_messages(self._query, byref(msgs_p)) if status != 0: raise NotmuchError(status) diff --git a/bindings/ruby/query.c b/bindings/ruby/query.c index 4b3f1c4f..2e36df6a 100644 --- a/bindings/ruby/query.c +++ b/bindings/ruby/query.c @@ -159,7 +159,7 @@ notmuch_rb_query_search_messages (VALUE self) Data_Get_Notmuch_Query (self, query); - status = notmuch_query_search_messages_st (query, &messages); + status = notmuch_query_search_messages (query, &messages); if (status) notmuch_rb_status_raise (status); diff --git a/lib/database.cc b/lib/database.cc index a679cbab..125c4b92 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -1531,7 +1531,7 @@ notmuch_database_upgrade (notmuch_database_t *notmuch, query = notmuch_query_create (notmuch, ""); - status = notmuch_query_search_messages_st (query, &messages); + status = notmuch_query_search_messages (query, &messages); if (status) goto DONE; for (; diff --git a/lib/notmuch.h b/lib/notmuch.h index 601b2e3e..4b01e3ad 100644 --- a/lib/notmuch.h +++ b/lib/notmuch.h @@ -911,23 +911,23 @@ notmuch_query_search_threads_st (notmuch_query_t *query, notmuch_threads_t **out * * If a Xapian exception occurs this function will return NULL. * - * @since libnotmuch 4.2 (notmuch 0.20) + * @since libnotmuch 5 (notmuch 0.25) */ notmuch_status_t -notmuch_query_search_messages_st (notmuch_query_t *query, - notmuch_messages_t **out); +notmuch_query_search_messages (notmuch_query_t *query, + notmuch_messages_t **out); /** - * Like notmuch_query_search_messages, but without a status return. - * - * If a Xapian exception occurs this function will return NULL. + * Deprecated alias for notmuch_query_search_messages * - * @deprecated Deprecated as of libnotmuch 4.3 (notmuch 0.21). Please use - * notmuch_query_search_messages_st instead. + * @deprecated Deprecated as of libnotmuch 5 (notmuch 0.25). Please use + * notmuch_query_search_messages instead. * */ -NOTMUCH_DEPRECATED(4,3) -notmuch_messages_t * -notmuch_query_search_messages (notmuch_query_t *query); + +NOTMUCH_DEPRECATED(5,0) +notmuch_status_t +notmuch_query_search_messages_st (notmuch_query_t *query, + notmuch_messages_t **out); /** * Destroy a notmuch_query_t along with any associated resources. diff --git a/lib/query.cc b/lib/query.cc index 2581ee64..7192e7f0 100644 --- a/lib/query.cc +++ b/lib/query.cc @@ -233,20 +233,16 @@ _notmuch_exclude_tags (notmuch_query_t *query) return exclude_query; } -notmuch_messages_t * -notmuch_query_search_messages (notmuch_query_t *query) + +notmuch_status_t +notmuch_query_search_messages_st (notmuch_query_t *query, + notmuch_messages_t **out) { - notmuch_status_t status; - notmuch_messages_t *messages; - status = notmuch_query_search_messages_st (query, &messages); - if (status) - return NULL; - else - return messages; + return notmuch_query_search_messages (query, out); } notmuch_status_t -notmuch_query_search_messages_st (notmuch_query_t *query, +notmuch_query_search_messages (notmuch_query_t *query, notmuch_messages_t **out) { return _notmuch_query_search_documents (query, "mail", out); @@ -519,7 +515,7 @@ notmuch_query_search_threads (notmuch_query_t *query, threads->query = query; - status = notmuch_query_search_messages_st (query, &messages); + status = notmuch_query_search_messages (query, &messages); if (status) { talloc_free (threads); return status; @@ -708,7 +704,7 @@ notmuch_query_count_threads_st (notmuch_query_t *query, unsigned *count) sort = query->sort; query->sort = NOTMUCH_SORT_UNSORTED; - ret = notmuch_query_search_messages_st (query, &messages); + ret = notmuch_query_search_messages (query, &messages); if (ret) return ret; query->sort = sort; diff --git a/lib/thread.cc b/lib/thread.cc index 84ee5298..561ca5be 100644 --- a/lib/thread.cc +++ b/lib/thread.cc @@ -505,7 +505,7 @@ _notmuch_thread_create (void *ctx, * oldest or newest subject is desired. */ notmuch_query_set_sort (thread_id_query, NOTMUCH_SORT_OLDEST_FIRST); - status = notmuch_query_search_messages_st (thread_id_query, &messages); + status = notmuch_query_search_messages (thread_id_query, &messages); if (status) goto DONE; diff --git a/notmuch-count.c b/notmuch-count.c index 35a2aa70..d3457bbe 100644 --- a/notmuch-count.c +++ b/notmuch-count.c @@ -43,7 +43,7 @@ count_files (notmuch_query_t *query) notmuch_status_t status; int count = 0; - status = notmuch_query_search_messages_st (query, &messages); + status = notmuch_query_search_messages (query, &messages); if (print_status_query ("notmuch count", query, status)) return -1; diff --git a/notmuch-dump.c b/notmuch-dump.c index e7965cea..0cbcdc16 100644 --- a/notmuch-dump.c +++ b/notmuch-dump.c @@ -240,7 +240,7 @@ database_dump_file (notmuch_database_t *notmuch, gzFile output, */ notmuch_query_set_sort (query, NOTMUCH_SORT_UNSORTED); - status = notmuch_query_search_messages_st (query, &messages); + status = notmuch_query_search_messages (query, &messages); if (print_status_query ("notmuch dump", query, status)) return EXIT_FAILURE; diff --git a/notmuch-reply.c b/notmuch-reply.c index 166a5946..85efc702 100644 --- a/notmuch-reply.c +++ b/notmuch-reply.c @@ -645,7 +645,7 @@ static int do_reply(notmuch_config_t *config, sp = sprinter_sexp_create (config, stdout); } - status = notmuch_query_search_messages_st (query, &messages); + status = notmuch_query_search_messages (query, &messages); if (print_status_query ("notmuch reply", query, status)) return 1; diff --git a/notmuch-search.c b/notmuch-search.c index c6899ffa..1c4d5205 100644 --- a/notmuch-search.c +++ b/notmuch-search.c @@ -538,7 +538,7 @@ do_search_messages (search_context_t *ctx) ctx->offset = 0; } - status = notmuch_query_search_messages_st (ctx->query, &messages); + status = notmuch_query_search_messages (ctx->query, &messages); if (print_status_query ("notmuch search", ctx->query, status)) return 1; @@ -629,7 +629,7 @@ do_search_tags (const search_context_t *ctx) tags = notmuch_database_get_all_tags (notmuch); } else { notmuch_status_t status; - status = notmuch_query_search_messages_st (query, &messages); + status = notmuch_query_search_messages (query, &messages); if (print_status_query ("notmuch search", query, status)) return 1; diff --git a/notmuch-show.c b/notmuch-show.c index 75fb2849..ff8228fe 100644 --- a/notmuch-show.c +++ b/notmuch-show.c @@ -917,7 +917,7 @@ do_show_single (void *ctx, return 1; } - status = notmuch_query_search_messages_st (query, &messages); + status = notmuch_query_search_messages (query, &messages); if (print_status_query ("notmuch show", query, status)) return 1; diff --git a/notmuch-tag.c b/notmuch-tag.c index 18d78ddd..9c03754d 100644 --- a/notmuch-tag.c +++ b/notmuch-tag.c @@ -121,7 +121,7 @@ tag_query (void *ctx, notmuch_database_t *notmuch, const char *query_string, /* tagging is not interested in any special sort order */ notmuch_query_set_sort (query, NOTMUCH_SORT_UNSORTED); - status = notmuch_query_search_messages_st (query, &messages); + status = notmuch_query_search_messages (query, &messages); if (print_status_query ("notmuch tag", query, status)) return status; diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh index e775216e..f18c8813 100755 --- a/test/T560-lib-error.sh +++ b/test/T560-lib-error.sh @@ -286,7 +286,7 @@ cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} { notmuch_messages_t *messages = NULL; notmuch_query_t *query=notmuch_query_create (db, "*"); - stat = notmuch_query_search_messages_st (query, &messages); + stat = notmuch_query_search_messages (query, &messages); } EOF sed 's/^\(A Xapian exception [^:]*\):.*$/\1/' < OUTPUT > OUTPUT.clean diff --git a/test/T640-database-modified.sh b/test/T640-database-modified.sh index 92758e19..e35e35f6 100755 --- a/test/T640-database-modified.sh +++ b/test/T640-database-modified.sh @@ -35,7 +35,7 @@ main (int argc, char **argv) EXPECT0 (notmuch_database_open (path, NOTMUCH_DATABASE_MODE_READ_WRITE, &rw_db)); query = notmuch_query_create(rw_db, ""); - EXPECT0 (notmuch_query_search_messages_st (query, &messages)); + EXPECT0 (notmuch_query_search_messages (query, &messages)); for (; notmuch_messages_valid (messages);