diff options
author | David Bremner <david@tethera.net> | 2017-02-26 17:21:34 -0400 |
---|---|---|
committer | David Bremner <david@tethera.net> | 2017-03-22 08:35:07 -0300 |
commit | 5ce8e0b11b40f733e6231d2067764e76717a341a (patch) | |
tree | b58f3e8f804d2d06e7070be05c71941c342c38a3 | |
parent | 86cbd215eb67d7b996c977352a50e70c101cb641 (diff) |
lib: replace deprecated n_q_count_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. One or two
remaining uses of the (removed) non-status returning version fixed at
the same time
-rw-r--r-- | bindings/python/notmuch/query.py | 2 | ||||
-rw-r--r-- | bindings/ruby/query.c | 2 | ||||
-rw-r--r-- | lib/database.cc | 2 | ||||
-rw-r--r-- | lib/message.cc | 2 | ||||
-rw-r--r-- | lib/notmuch.h | 17 | ||||
-rw-r--r-- | lib/query.cc | 12 | ||||
-rw-r--r-- | notmuch-count.c | 2 | ||||
-rw-r--r-- | notmuch-reply.c | 2 | ||||
-rw-r--r-- | notmuch-search.c | 2 | ||||
-rw-r--r-- | notmuch-show.c | 2 | ||||
-rwxr-xr-x | test/T560-lib-error.sh | 4 |
11 files changed, 22 insertions, 27 deletions
diff --git a/bindings/python/notmuch/query.py b/bindings/python/notmuch/query.py index a91bb740..10fb6dcc 100644 --- a/bindings/python/notmuch/query.py +++ b/bindings/python/notmuch/query.py @@ -185,7 +185,7 @@ class Query(object): raise NullPointerError return Messages(msgs_p, self) - _count_messages = nmlib.notmuch_query_count_messages_st + _count_messages = nmlib.notmuch_query_count_messages _count_messages.argtypes = [NotmuchQueryP, POINTER(c_uint)] _count_messages.restype = c_uint diff --git a/bindings/ruby/query.c b/bindings/ruby/query.c index 2e36df6a..b6edaef3 100644 --- a/bindings/ruby/query.c +++ b/bindings/ruby/query.c @@ -180,7 +180,7 @@ notmuch_rb_query_count_messages (VALUE self) Data_Get_Notmuch_Query (self, query); - status = notmuch_query_count_messages_st (query, &count); + status = notmuch_query_count_messages (query, &count); if (status) notmuch_rb_status_raise (status); diff --git a/lib/database.cc b/lib/database.cc index 125c4b92..5bc131a3 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -1493,7 +1493,7 @@ notmuch_database_upgrade (notmuch_database_t *notmuch, query = notmuch_query_create (notmuch, ""); unsigned msg_count; - status = notmuch_query_count_messages_st (query, &msg_count); + status = notmuch_query_count_messages (query, &msg_count); if (status) goto DONE; diff --git a/lib/message.cc b/lib/message.cc index cb313326..f8215a49 100644 --- a/lib/message.cc +++ b/lib/message.cc @@ -1129,7 +1129,7 @@ _notmuch_message_delete (notmuch_message_t *message) query = notmuch_query_create (notmuch, query_string); if (query == NULL) return NOTMUCH_STATUS_OUT_OF_MEMORY; - status = notmuch_query_count_messages_st (query, &count); + status = notmuch_query_count_messages (query, &count); if (status) { notmuch_query_destroy (query); return status; diff --git a/lib/notmuch.h b/lib/notmuch.h index 4b01e3ad..b79618f6 100644 --- a/lib/notmuch.h +++ b/lib/notmuch.h @@ -1008,22 +1008,21 @@ notmuch_threads_destroy (notmuch_threads_t *threads); * NOTMUCH_STATUS_XAPIAN_EXCEPTION: a Xapian exception occured. The * value of *count is not defined. * - * @since libnotmuch 4.3 (notmuch 0.21) + * @since libnotmuch 5 (notmuch 0.25) */ notmuch_status_t -notmuch_query_count_messages_st (notmuch_query_t *query, unsigned int *count); +notmuch_query_count_messages (notmuch_query_t *query, unsigned int *count); /** - * like notmuch_query_count_messages_st, but without a status return. + * Deprecated alias for notmuch_query_count_messages * - * May return 0 in the case of errors. * - * @deprecated Deprecated since libnotmuch 4.3 (notmuch 0.21). Please - * use notmuch_query_count_messages_st instead. + * @deprecated Deprecated since libnotmuch 5.0 (notmuch 0.25). Please + * use notmuch_query_count_messages instead. */ -NOTMUCH_DEPRECATED(4,3) -unsigned int -notmuch_query_count_messages (notmuch_query_t *query); +NOTMUCH_DEPRECATED(5,0) +notmuch_status_t +notmuch_query_count_messages_st (notmuch_query_t *query, unsigned int *count); /** * Return the number of threads matching a search. diff --git a/lib/query.cc b/lib/query.cc index 7192e7f0..754ccfcc 100644 --- a/lib/query.cc +++ b/lib/query.cc @@ -598,18 +598,14 @@ notmuch_threads_destroy (notmuch_threads_t *threads) talloc_free (threads); } -unsigned int -notmuch_query_count_messages (notmuch_query_t *query) +notmuch_status_t +notmuch_query_count_messages_st (notmuch_query_t *query, unsigned *count_out) { - notmuch_status_t status; - unsigned int count; - - status = notmuch_query_count_messages_st (query, &count); - return status ? 0 : count; + return notmuch_query_count_messages (query, count_out); } notmuch_status_t -notmuch_query_count_messages_st (notmuch_query_t *query, unsigned *count_out) +notmuch_query_count_messages (notmuch_query_t *query, unsigned *count_out) { return _notmuch_query_count_documents (query, "mail", count_out); } diff --git a/notmuch-count.c b/notmuch-count.c index d3457bbe..493be30f 100644 --- a/notmuch-count.c +++ b/notmuch-count.c @@ -92,7 +92,7 @@ print_count (notmuch_database_t *notmuch, const char *query_str, switch (output) { case OUTPUT_MESSAGES: - status = notmuch_query_count_messages_st (query, &ucount); + status = notmuch_query_count_messages (query, &ucount); if (print_status_query ("notmuch count", query, status)) return -1; printf ("%u", ucount); diff --git a/notmuch-reply.c b/notmuch-reply.c index 85efc702..2fa6e5a3 100644 --- a/notmuch-reply.c +++ b/notmuch-reply.c @@ -630,7 +630,7 @@ static int do_reply(notmuch_config_t *config, if (format == FORMAT_JSON || format == FORMAT_SEXP) { unsigned count; - status = notmuch_query_count_messages_st (query, &count); + status = notmuch_query_count_messages (query, &count); if (print_status_query ("notmuch reply", query, status)) return 1; diff --git a/notmuch-search.c b/notmuch-search.c index 1c4d5205..71218fdd 100644 --- a/notmuch-search.c +++ b/notmuch-search.c @@ -529,7 +529,7 @@ do_search_messages (search_context_t *ctx) if (ctx->offset < 0) { unsigned count; notmuch_status_t status; - status = notmuch_query_count_messages_st (ctx->query, &count); + status = notmuch_query_count_messages (ctx->query, &count); if (print_status_query ("notmuch search", ctx->query, status)) return 1; diff --git a/notmuch-show.c b/notmuch-show.c index ff8228fe..64005948 100644 --- a/notmuch-show.c +++ b/notmuch-show.c @@ -908,7 +908,7 @@ do_show_single (void *ctx, notmuch_status_t status; unsigned int count; - status = notmuch_query_count_messages_st (query, &count); + status = notmuch_query_count_messages (query, &count); if (print_status_query ("notmuch show", query, status)) return 1; diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh index f18c8813..34d15698 100755 --- a/test/T560-lib-error.sh +++ b/test/T560-lib-error.sh @@ -303,9 +303,9 @@ backup_database test_begin_subtest "Xapian exception counting messages" cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} { + int count; notmuch_query_t *query=notmuch_query_create (db, "id:87ocn0qh6d.fsf@yoom.home.cworth.org"); - int count = notmuch_query_count_messages (query); - stat = (count == 0); + stat = notmuch_query_count_messages (query, &count); } EOF sed 's/^\(A Xapian exception [^:]*\):.*$/\1/' < OUTPUT > OUTPUT.clean |