lib: replace n_query_search_threads with status returning version

This function was deprecated in notmuch 0.21. We finally remove the
deprecated API, and rename the status returning version to the simpler
name. The status returning is kept as a deprecated alias.
This commit is contained in:
David Bremner 2017-02-26 17:21:31 -04:00
parent fc63c15833
commit 1e982de508
6 changed files with 22 additions and 31 deletions

View file

@ -134,10 +134,10 @@ class Query(object):
self._assert_query_is_initialized() self._assert_query_is_initialized()
self._exclude_tag(self._query, _str(tagname)) self._exclude_tag(self._query, _str(tagname))
"""notmuch_query_search_threads_st""" """notmuch_query_search_threads"""
_search_threads_st = nmlib.notmuch_query_search_threads_st _search_threads = nmlib.notmuch_query_search_threads
_search_threads_st.argtypes = [NotmuchQueryP, POINTER(NotmuchThreadsP)] _search_threads.argtypes = [NotmuchQueryP, POINTER(NotmuchThreadsP)]
_search_threads_st.restype = c_uint _search_threads.restype = c_uint
def search_threads(self): def search_threads(self):
"""Execute a query for threads """Execute a query for threads
@ -155,7 +155,7 @@ class Query(object):
""" """
self._assert_query_is_initialized() self._assert_query_is_initialized()
threads_p = NotmuchThreadsP() # == NULL threads_p = NotmuchThreadsP() # == NULL
status = Query._search_threads_st(self._query, byref(threads_p)) status = Query._search_threads(self._query, byref(threads_p))
if status != 0: if status != 0:
raise NotmuchError(status) raise NotmuchError(status)

View file

@ -138,7 +138,7 @@ notmuch_rb_query_search_threads (VALUE self)
Data_Get_Notmuch_Query (self, query); Data_Get_Notmuch_Query (self, query);
status = notmuch_query_search_threads_st (query, &threads); status = notmuch_query_search_threads (query, &threads);
if (status) if (status)
notmuch_rb_status_raise (status); notmuch_rb_status_raise (status);

View file

@ -855,24 +855,22 @@ notmuch_query_add_tag_exclude (notmuch_query_t *query, const char *tag);
* notmuch_threads_destroy function, but there's no good reason * notmuch_threads_destroy function, but there's no good reason
* to call it if the query is about to be destroyed). * to call it if the query is about to be destroyed).
* *
* @since libnotmuch 4.2 (notmuch 0.20) * @since libnotmuch 5.0 (notmuch 0.25)
*/ */
notmuch_status_t notmuch_status_t
notmuch_query_search_threads_st (notmuch_query_t *query, notmuch_query_search_threads (notmuch_query_t *query,
notmuch_threads_t **out); notmuch_threads_t **out);
/** /**
* Like notmuch_query_search_threads_st, but without a status return. * Deprecated alias for notmuch_query_search_threads.
* *
* If a Xapian exception occurs this function will return NULL. * @deprecated Deprecated as of libnotmuch 5 (notmuch 0.25). Please
* * use notmuch_query_search_threads instead.
* @deprecated Deprecated as of libnotmuch 4.3 (notmuch 0.21). Please
* use notmuch_query_search_threads_st instead.
* *
*/ */
NOTMUCH_DEPRECATED(4,3) NOTMUCH_DEPRECATED(5,0)
notmuch_threads_t * notmuch_status_t
notmuch_query_search_threads (notmuch_query_t *query); notmuch_query_search_threads_st (notmuch_query_t *query, notmuch_threads_t **out);
/** /**
* Execute a query for messages, returning a notmuch_messages_t object * Execute a query for messages, returning a notmuch_messages_t object

View file

@ -497,21 +497,14 @@ _notmuch_threads_destructor (notmuch_threads_t *threads)
return 0; return 0;
} }
notmuch_status_t
notmuch_threads_t * notmuch_query_search_threads_st (notmuch_query_t *query, notmuch_threads_t **out)
notmuch_query_search_threads (notmuch_query_t *query)
{ {
notmuch_status_t status; return notmuch_query_search_threads(query, out);
notmuch_threads_t *threads;
status = notmuch_query_search_threads_st (query, &threads);
if (status)
return NULL;
else
return threads;
} }
notmuch_status_t notmuch_status_t
notmuch_query_search_threads_st (notmuch_query_t *query, notmuch_query_search_threads (notmuch_query_t *query,
notmuch_threads_t **out) notmuch_threads_t **out)
{ {
notmuch_threads_t *threads; notmuch_threads_t *threads;

View file

@ -132,7 +132,7 @@ do_search_threads (search_context_t *ctx)
ctx->offset = 0; ctx->offset = 0;
} }
status = notmuch_query_search_threads_st (ctx->query, &threads); status = notmuch_query_search_threads (ctx->query, &threads);
if (print_status_query("notmuch search", ctx->query, status)) if (print_status_query("notmuch search", ctx->query, status))
return 1; return 1;

View file

@ -947,7 +947,7 @@ do_show (void *ctx,
notmuch_messages_t *messages; notmuch_messages_t *messages;
notmuch_status_t status, res = NOTMUCH_STATUS_SUCCESS; notmuch_status_t status, res = NOTMUCH_STATUS_SUCCESS;
status= notmuch_query_search_threads_st (query, &threads); status= notmuch_query_search_threads (query, &threads);
if (print_status_query ("notmuch show", query, status)) if (print_status_query ("notmuch show", query, status))
return 1; return 1;