[PATCH 2/6] lib: replace n_query_search_threads with status returning version

Subject:[PATCH 2/6] lib: replace n_query_search_threads with status returning version

Date:Sun, 26 Feb 2017 17:21:31 -0400

To:David Bremner ,notmuch@notmuchmail.org

Cc:

From:David Bremner


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.
---
 bindings/python/notmuch/query.py | 10 +++++-----
 bindings/ruby/query.c            |  2 +-
 lib/notmuch.h                    | 20 +++++++++-----------
 lib/query.cc                     | 17 +++++------------
 notmuch-search.c                 |  2 +-
 notmuch-show.c                   |  2 +-
 6 files changed, 22 insertions(+), 31 deletions(-)

diff --git a/bindings/python/notmuch/query.py b/bindings/python/notmuch/query.py
index a0f4f64b..3419f626 100644
--- a/bindings/python/notmuch/query.py
+++ b/bindings/python/notmuch/query.py
@@ -134,10 +134,10 @@ class Query(object):
         self._assert_query_is_initialized()
         self._exclude_tag(self._query, _str(tagname))
 
-    """notmuch_query_search_threads_st"""
-    _search_threads_st = nmlib.notmuch_query_search_threads_st
-    _search_threads_st.argtypes = [NotmuchQueryP, POINTER(NotmuchThreadsP)]
-    _search_threads_st.restype = c_uint
+    """notmuch_query_search_threads"""
+    _search_threads = nmlib.notmuch_query_search_threads
+    _search_threads.argtypes = [NotmuchQueryP, POINTER(NotmuchThreadsP)]
+    _search_threads.restype = c_uint
 
     def search_threads(self):
         """Execute a query for threads
@@ -155,7 +155,7 @@ class Query(object):
         """
         self._assert_query_is_initialized()
         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:
             raise NotmuchError(status)
 
diff --git a/bindings/ruby/query.c b/bindings/ruby/query.c
index ce66926c..4b3f1c4f 100644
--- a/bindings/ruby/query.c
+++ b/bindings/ruby/query.c
@@ -138,7 +138,7 @@ notmuch_rb_query_search_threads (VALUE self)
 
     Data_Get_Notmuch_Query (self, query);
 
-    status = notmuch_query_search_threads_st (query, &threads);
+    status = notmuch_query_search_threads (query, &threads);
     if (status)
 	notmuch_rb_status_raise (status);
 
diff --git a/lib/notmuch.h b/lib/notmuch.h
index af4efbc8..601b2e3e 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -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
  * 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_query_search_threads_st (notmuch_query_t *query,
-				 notmuch_threads_t **out);
+notmuch_query_search_threads (notmuch_query_t *query,
+			      notmuch_threads_t **out);
 
 /**
- * Like notmuch_query_search_threads_st, but without a status return.
- *
- * If a Xapian exception occurs this function will return NULL.
+ * Deprecated alias for notmuch_query_search_threads.
  *
- * @deprecated Deprecated as of libnotmuch 4.3 (notmuch 0.21). Please
- * use notmuch_query_search_threads_st instead.
+ * @deprecated Deprecated as of libnotmuch 5 (notmuch 0.25). Please
+ * use notmuch_query_search_threads instead.
  *
  */
-NOTMUCH_DEPRECATED(4,3)
-notmuch_threads_t *
-notmuch_query_search_threads (notmuch_query_t *query);
+NOTMUCH_DEPRECATED(5,0)
+notmuch_status_t
+notmuch_query_search_threads_st (notmuch_query_t *query, notmuch_threads_t **out);
 
 /**
  * Execute a query for messages, returning a notmuch_messages_t object
diff --git a/lib/query.cc b/lib/query.cc
index 4ccd8104..d138f09b 100644
--- a/lib/query.cc
+++ b/lib/query.cc
@@ -432,22 +432,15 @@ _notmuch_threads_destructor (notmuch_threads_t *threads)
     return 0;
 }
 
-
-notmuch_threads_t *
-notmuch_query_search_threads (notmuch_query_t *query)
+notmuch_status_t
+notmuch_query_search_threads_st (notmuch_query_t *query, notmuch_threads_t **out)
 {
-    notmuch_status_t status;
-    notmuch_threads_t *threads;
-    status = notmuch_query_search_threads_st (query, &threads);
-    if (status)
-	return NULL;
-    else
-	return threads;
+    return notmuch_query_search_threads(query, out);
 }
 
 notmuch_status_t
-notmuch_query_search_threads_st (notmuch_query_t *query,
-				 notmuch_threads_t **out)
+notmuch_query_search_threads (notmuch_query_t *query,
+			      notmuch_threads_t **out)
 {
     notmuch_threads_t *threads;
     notmuch_messages_t *messages;
diff --git a/notmuch-search.c b/notmuch-search.c
index 8c65d5ad..c6899ffa 100644
--- a/notmuch-search.c
+++ b/notmuch-search.c
@@ -132,7 +132,7 @@ do_search_threads (search_context_t *ctx)
 	    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))
 	return 1;
 
diff --git a/notmuch-show.c b/notmuch-show.c
index ab4ea1c2..3e87bfec 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -951,7 +951,7 @@ do_show (void *ctx,
     notmuch_messages_t *messages;
     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))
 	return 1;
 
-- 
2.11.0


Thread: