mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-27 13:17:56 +01:00
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
This commit is contained in:
parent
86cbd215eb
commit
5ce8e0b11b
11 changed files with 22 additions and 27 deletions
|
@ -185,7 +185,7 @@ class Query(object):
|
||||||
raise NullPointerError
|
raise NullPointerError
|
||||||
return Messages(msgs_p, self)
|
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.argtypes = [NotmuchQueryP, POINTER(c_uint)]
|
||||||
_count_messages.restype = c_uint
|
_count_messages.restype = c_uint
|
||||||
|
|
||||||
|
|
|
@ -180,7 +180,7 @@ notmuch_rb_query_count_messages (VALUE self)
|
||||||
|
|
||||||
Data_Get_Notmuch_Query (self, query);
|
Data_Get_Notmuch_Query (self, query);
|
||||||
|
|
||||||
status = notmuch_query_count_messages_st (query, &count);
|
status = notmuch_query_count_messages (query, &count);
|
||||||
if (status)
|
if (status)
|
||||||
notmuch_rb_status_raise (status);
|
notmuch_rb_status_raise (status);
|
||||||
|
|
||||||
|
|
|
@ -1493,7 +1493,7 @@ notmuch_database_upgrade (notmuch_database_t *notmuch,
|
||||||
query = notmuch_query_create (notmuch, "");
|
query = notmuch_query_create (notmuch, "");
|
||||||
unsigned msg_count;
|
unsigned msg_count;
|
||||||
|
|
||||||
status = notmuch_query_count_messages_st (query, &msg_count);
|
status = notmuch_query_count_messages (query, &msg_count);
|
||||||
if (status)
|
if (status)
|
||||||
goto DONE;
|
goto DONE;
|
||||||
|
|
||||||
|
|
|
@ -1129,7 +1129,7 @@ _notmuch_message_delete (notmuch_message_t *message)
|
||||||
query = notmuch_query_create (notmuch, query_string);
|
query = notmuch_query_create (notmuch, query_string);
|
||||||
if (query == NULL)
|
if (query == NULL)
|
||||||
return NOTMUCH_STATUS_OUT_OF_MEMORY;
|
return NOTMUCH_STATUS_OUT_OF_MEMORY;
|
||||||
status = notmuch_query_count_messages_st (query, &count);
|
status = notmuch_query_count_messages (query, &count);
|
||||||
if (status) {
|
if (status) {
|
||||||
notmuch_query_destroy (query);
|
notmuch_query_destroy (query);
|
||||||
return status;
|
return status;
|
||||||
|
|
|
@ -1008,22 +1008,21 @@ notmuch_threads_destroy (notmuch_threads_t *threads);
|
||||||
* NOTMUCH_STATUS_XAPIAN_EXCEPTION: a Xapian exception occured. The
|
* NOTMUCH_STATUS_XAPIAN_EXCEPTION: a Xapian exception occured. The
|
||||||
* value of *count is not defined.
|
* value of *count is not defined.
|
||||||
*
|
*
|
||||||
* @since libnotmuch 4.3 (notmuch 0.21)
|
* @since libnotmuch 5 (notmuch 0.25)
|
||||||
*/
|
*/
|
||||||
notmuch_status_t
|
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
|
* @deprecated Deprecated since libnotmuch 5.0 (notmuch 0.25). Please
|
||||||
* use notmuch_query_count_messages_st instead.
|
* use notmuch_query_count_messages instead.
|
||||||
*/
|
*/
|
||||||
NOTMUCH_DEPRECATED(4,3)
|
NOTMUCH_DEPRECATED(5,0)
|
||||||
unsigned int
|
notmuch_status_t
|
||||||
notmuch_query_count_messages (notmuch_query_t *query);
|
notmuch_query_count_messages_st (notmuch_query_t *query, unsigned int *count);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the number of threads matching a search.
|
* Return the number of threads matching a search.
|
||||||
|
|
12
lib/query.cc
12
lib/query.cc
|
@ -598,18 +598,14 @@ notmuch_threads_destroy (notmuch_threads_t *threads)
|
||||||
talloc_free (threads);
|
talloc_free (threads);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int
|
notmuch_status_t
|
||||||
notmuch_query_count_messages (notmuch_query_t *query)
|
notmuch_query_count_messages_st (notmuch_query_t *query, unsigned *count_out)
|
||||||
{
|
{
|
||||||
notmuch_status_t status;
|
return notmuch_query_count_messages (query, count_out);
|
||||||
unsigned int count;
|
|
||||||
|
|
||||||
status = notmuch_query_count_messages_st (query, &count);
|
|
||||||
return status ? 0 : count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
notmuch_status_t
|
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);
|
return _notmuch_query_count_documents (query, "mail", count_out);
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,7 @@ print_count (notmuch_database_t *notmuch, const char *query_str,
|
||||||
|
|
||||||
switch (output) {
|
switch (output) {
|
||||||
case OUTPUT_MESSAGES:
|
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))
|
if (print_status_query ("notmuch count", query, status))
|
||||||
return -1;
|
return -1;
|
||||||
printf ("%u", ucount);
|
printf ("%u", ucount);
|
||||||
|
|
|
@ -630,7 +630,7 @@ static int do_reply(notmuch_config_t *config,
|
||||||
if (format == FORMAT_JSON || format == FORMAT_SEXP) {
|
if (format == FORMAT_JSON || format == FORMAT_SEXP) {
|
||||||
unsigned count;
|
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))
|
if (print_status_query ("notmuch reply", query, status))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
|
|
@ -529,7 +529,7 @@ do_search_messages (search_context_t *ctx)
|
||||||
if (ctx->offset < 0) {
|
if (ctx->offset < 0) {
|
||||||
unsigned count;
|
unsigned count;
|
||||||
notmuch_status_t status;
|
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))
|
if (print_status_query ("notmuch search", ctx->query, status))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
|
|
@ -908,7 +908,7 @@ do_show_single (void *ctx,
|
||||||
notmuch_status_t status;
|
notmuch_status_t status;
|
||||||
unsigned int count;
|
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))
|
if (print_status_query ("notmuch show", query, status))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
|
|
@ -303,9 +303,9 @@ backup_database
|
||||||
test_begin_subtest "Xapian exception counting messages"
|
test_begin_subtest "Xapian exception counting messages"
|
||||||
cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}
|
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");
|
notmuch_query_t *query=notmuch_query_create (db, "id:87ocn0qh6d.fsf@yoom.home.cworth.org");
|
||||||
int count = notmuch_query_count_messages (query);
|
stat = notmuch_query_count_messages (query, &count);
|
||||||
stat = (count == 0);
|
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
sed 's/^\(A Xapian exception [^:]*\):.*$/\1/' < OUTPUT > OUTPUT.clean
|
sed 's/^\(A Xapian exception [^:]*\):.*$/\1/' < OUTPUT > OUTPUT.clean
|
||||||
|
|
Loading…
Reference in a new issue