[PATCH] lib: remove notmuch_query_{count,search}_{threads,messages}

classic Classic list List threaded Threaded
12 messages Options
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|

[PATCH] lib: remove notmuch_query_{count,search}_{threads,messages}

These 4 functions were originally deprecated in notmuch 0.21, more
than a year ago.
---
 lib/notmuch.h          | 50 --------------------------------------------------
 test/T560-lib-error.sh |  4 ++--
 2 files changed, 2 insertions(+), 52 deletions(-)

diff --git a/lib/notmuch.h b/lib/notmuch.h
index 16da8be9..5c9f5137 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -862,19 +862,6 @@ notmuch_query_search_threads_st (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 Deprecated as of libnotmuch 4.3 (notmuch 0.21). Please
- * use notmuch_query_search_threads_st instead.
- *
- */
-NOTMUCH_DEPRECATED(4,3)
-notmuch_threads_t *
-notmuch_query_search_threads (notmuch_query_t *query);
-
-/**
  * Execute a query for messages, returning a notmuch_messages_t object
  * which can be used to iterate over the results. The returned
  * messages object is owned by the query and as such, will only be
@@ -919,19 +906,6 @@ notmuch_status_t
 notmuch_query_search_messages_st (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 Deprecated as of libnotmuch 4.3 (notmuch 0.21). Please use
- * notmuch_query_search_messages_st instead.
- *
- */
-NOTMUCH_DEPRECATED(4,3)
-notmuch_messages_t *
-notmuch_query_search_messages (notmuch_query_t *query);
-
-/**
  * Destroy a notmuch_query_t along with any associated resources.
  *
  * This will in turn destroy any notmuch_threads_t and
@@ -1016,18 +990,6 @@ notmuch_status_t
 notmuch_query_count_messages_st (notmuch_query_t *query, unsigned int *count);
 
 /**
- * like notmuch_query_count_messages_st, but without a status return.
- *
- * 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.
- */
-NOTMUCH_DEPRECATED(4,3)
-unsigned int
-notmuch_query_count_messages (notmuch_query_t *query);
-
-/**
  * Return the number of threads matching a search.
  *
  * This function performs a search and returns the number of unique thread IDs
@@ -1053,18 +1015,6 @@ notmuch_status_t
 notmuch_query_count_threads_st (notmuch_query_t *query, unsigned *count);
 
 /**
- * like notmuch_query_count_threads, but without a status return.
- *
- * May return 0 in case of errors.
- *
- * @deprecated Deprecated as of libnotmuch 4.3 (notmuch 0.21). Please
- * use notmuch_query_count_threads_st instead.
- */
-NOTMUCH_DEPRECATED(4,3)
-unsigned int
-notmuch_query_count_threads (notmuch_query_t *query);
-
-/**
  * Get the thread ID of 'thread'.
  *
  * The returned string belongs to 'thread' and as such, should not be
diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh
index 087c6bd7..a59eb74d 100755
--- a/test/T560-lib-error.sh
+++ b/test/T560-lib-error.sh
@@ -302,9 +302,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:[hidden email]");
-       int count = notmuch_query_count_messages (query);
-       stat = (count == 0);
+       stat = notmuch_query_count_messages_st (query, &count);
    }
 EOF
 sed 's/^\(A Xapian exception [^:]*\):.*$/\1/' < OUTPUT > OUTPUT.clean
--
2.11.0

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
Jani Nikula Jani Nikula
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] lib: remove notmuch_query_{count, search}_{threads, messages}

On Wed, 22 Feb 2017, David Bremner <[hidden email]> wrote:
> These 4 functions were originally deprecated in notmuch 0.21, more
> than a year ago.

This leaves the implementations of the functions as unused code behind.

How long until we can add them back with the same signature as the _st
versions, and deprecate the _st versions instead? ;)

> ---
>  lib/notmuch.h          | 50 --------------------------------------------------
>  test/T560-lib-error.sh |  4 ++--
>  2 files changed, 2 insertions(+), 52 deletions(-)
>
> diff --git a/lib/notmuch.h b/lib/notmuch.h
> index 16da8be9..5c9f5137 100644
> --- a/lib/notmuch.h
> +++ b/lib/notmuch.h
> @@ -862,19 +862,6 @@ notmuch_query_search_threads_st (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 Deprecated as of libnotmuch 4.3 (notmuch 0.21). Please
> - * use notmuch_query_search_threads_st instead.
> - *
> - */
> -NOTMUCH_DEPRECATED(4,3)
> -notmuch_threads_t *
> -notmuch_query_search_threads (notmuch_query_t *query);
> -
> -/**
>   * Execute a query for messages, returning a notmuch_messages_t object
>   * which can be used to iterate over the results. The returned
>   * messages object is owned by the query and as such, will only be
> @@ -919,19 +906,6 @@ notmuch_status_t
>  notmuch_query_search_messages_st (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 Deprecated as of libnotmuch 4.3 (notmuch 0.21). Please use
> - * notmuch_query_search_messages_st instead.
> - *
> - */
> -NOTMUCH_DEPRECATED(4,3)
> -notmuch_messages_t *
> -notmuch_query_search_messages (notmuch_query_t *query);
> -
> -/**
>   * Destroy a notmuch_query_t along with any associated resources.
>   *
>   * This will in turn destroy any notmuch_threads_t and
> @@ -1016,18 +990,6 @@ notmuch_status_t
>  notmuch_query_count_messages_st (notmuch_query_t *query, unsigned int *count);
>  
>  /**
> - * like notmuch_query_count_messages_st, but without a status return.
> - *
> - * 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.
> - */
> -NOTMUCH_DEPRECATED(4,3)
> -unsigned int
> -notmuch_query_count_messages (notmuch_query_t *query);
> -
> -/**
>   * Return the number of threads matching a search.
>   *
>   * This function performs a search and returns the number of unique thread IDs
> @@ -1053,18 +1015,6 @@ notmuch_status_t
>  notmuch_query_count_threads_st (notmuch_query_t *query, unsigned *count);
>  
>  /**
> - * like notmuch_query_count_threads, but without a status return.
> - *
> - * May return 0 in case of errors.
> - *
> - * @deprecated Deprecated as of libnotmuch 4.3 (notmuch 0.21). Please
> - * use notmuch_query_count_threads_st instead.
> - */
> -NOTMUCH_DEPRECATED(4,3)
> -unsigned int
> -notmuch_query_count_threads (notmuch_query_t *query);
> -
> -/**
>   * Get the thread ID of 'thread'.
>   *
>   * The returned string belongs to 'thread' and as such, should not be
> diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh
> index 087c6bd7..a59eb74d 100755
> --- a/test/T560-lib-error.sh
> +++ b/test/T560-lib-error.sh
> @@ -302,9 +302,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:[hidden email]");
> -       int count = notmuch_query_count_messages (query);
> -       stat = (count == 0);
> +       stat = notmuch_query_count_messages_st (query, &count);
>     }
>  EOF
>  sed 's/^\(A Xapian exception [^:]*\):.*$/\1/' < OUTPUT > OUTPUT.clean
> --
> 2.11.0
>
> _______________________________________________
> notmuch mailing list
> [hidden email]
> https://notmuchmail.org/mailman/listinfo/notmuch
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] lib: remove notmuch_query_{count, search}_{threads, messages}

Jani Nikula <[hidden email]> writes:

> On Wed, 22 Feb 2017, David Bremner <[hidden email]> wrote:
>> These 4 functions were originally deprecated in notmuch 0.21, more
>> than a year ago.
>
> This leaves the implementations of the functions as unused code behind.

oh oops.

> How long until we can add them back with the same signature as the _st
> versions, and deprecate the _st versions instead? ;)
>

I was thinking at least one release ;).

d

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
Tomi Ollila-2 Tomi Ollila-2
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] lib: remove notmuch_query_{count, search}_{threads, messages}

On Sat, Feb 25 2017, David Bremner <[hidden email]> wrote:

> Jani Nikula <[hidden email]> writes:
>
>> On Wed, 22 Feb 2017, David Bremner <[hidden email]> wrote:
>>> These 4 functions were originally deprecated in notmuch 0.21, more
>>> than a year ago.
>>
>> This leaves the implementations of the functions as unused code behind.

I thought this was intentional as there were no LIBNOTMUCH_*_VERSION bump.

>
> oh oops.
>
>> How long until we can add them back with the same signature as the _st
>> versions, and deprecate the _st versions instead? ;)
>>
>
> I was thinking at least one release ;).

So, for 0.25 the non _st versions are back, _st versions as wrapper (or
some linking-time aliases?/?) for the non_st and n-year deprecation period
for the _st version (to not piss developers using the API again ;) ?

>
> d

Tomi
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|

v2 remove notmuch_query_{count,search}_{threads,messages}

In reply to this post by David Bremner-2
After some discussion on IRC, here's a second version. This both
removes the old versions, and steals the name.

I've intentionally written notmuch 0.25 in the comments, as I'd like
to merge these changes, or something like them at the beginning of the
0.25 cycle. Origininally I thought that some of the library fixes for
for 0.25 needed API changes, but that doesn't seem to be the case.

d

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|

[PATCH 1/6] lib: bump SONAME to libnotmuch5

We plan a sequence of ABI breaking changes. Put the SONAME change in a
separate commit to make reordering easier.
---
 lib/notmuch.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/notmuch.h b/lib/notmuch.h
index 16da8be9..af4efbc8 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -55,8 +55,8 @@ NOTMUCH_BEGIN_DECLS
  * The library version number.  This must agree with the soname
  * version in Makefile.local.
  */
-#define LIBNOTMUCH_MAJOR_VERSION 4
-#define LIBNOTMUCH_MINOR_VERSION 4
+#define LIBNOTMUCH_MAJOR_VERSION 5
+#define LIBNOTMUCH_MINOR_VERSION 0
 #define LIBNOTMUCH_MICRO_VERSION 0
 
 
--
2.11.0

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|

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

In reply to this post by David Bremner-2
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

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|

[PATCH 3/6] lib: replace deprecated n_q_search_messages with status returning version

In reply to this post by David Bremner-2
This function was deprecated in notmuch 0.21.  We re-use the name for
a status returning version, and deprecate the _st name.
---
 bindings/python/notmuch/query.py |  6 +++---
 bindings/ruby/query.c            |  2 +-
 lib/database.cc                  |  2 +-
 lib/notmuch.h                    | 22 +++++++++++-----------
 lib/query.cc                     | 20 ++++++++------------
 lib/thread.cc                    |  2 +-
 notmuch-count.c                  |  2 +-
 notmuch-dump.c                   |  2 +-
 notmuch-reply.c                  |  2 +-
 notmuch-search.c                 |  4 ++--
 notmuch-show.c                   |  2 +-
 notmuch-tag.c                    |  2 +-
 test/T560-lib-error.sh           |  2 +-
 test/T640-database-modified.sh   |  2 +-
 14 files changed, 34 insertions(+), 38 deletions(-)

diff --git a/bindings/python/notmuch/query.py b/bindings/python/notmuch/query.py
index 3419f626..9942a2bc 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
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 ba440d4d..13b9e647 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -1501,7 +1501,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 d138f09b..60d1db94 100644
--- a/lib/query.cc
+++ b/lib/query.cc
@@ -171,20 +171,16 @@ _notmuch_exclude_tags (notmuch_query_t *query, Xapian::Query xquery)
     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);
@@ -454,7 +450,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;
@@ -640,7 +636,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 8c894974..2a3abfbd 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 3e87bfec..11eb0a6b 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -921,7 +921,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 087c6bd7..ccb77b04 100755
--- a/test/T560-lib-error.sh
+++ b/test/T560-lib-error.sh
@@ -285,7 +285,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);
--
2.11.0

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|

[PATCH 4/6] fixup! lib: replace deprecated n_q_search_messages with status returning version

In reply to this post by David Bremner-2
---
 bindings/python/notmuch/query.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bindings/python/notmuch/query.py b/bindings/python/notmuch/query.py
index 9942a2bc..a91bb740 100644
--- a/bindings/python/notmuch/query.py
+++ b/bindings/python/notmuch/query.py
@@ -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)
 
--
2.11.0

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|

[PATCH 5/6] lib: replace deprecated n_q_count_messages with status returning version

In reply to this post by David Bremner-2
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
---
 bindings/python/notmuch/query.py |  2 +-
 bindings/ruby/query.c            |  2 +-
 lib/database.cc                  |  2 +-
 lib/message.cc                   |  2 +-
 lib/notmuch.h                    | 17 ++++++++---------
 lib/query.cc                     | 12 ++++--------
 notmuch-count.c                  |  2 +-
 notmuch-reply.c                  |  2 +-
 notmuch-search.c                 |  2 +-
 notmuch-show.c                   |  2 +-
 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 13b9e647..4fc691ff 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -1463,7 +1463,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 007f1171..29e54425 100644
--- a/lib/message.cc
+++ b/lib/message.cc
@@ -1123,7 +1123,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 60d1db94..25b953c7 100644
--- a/lib/query.cc
+++ b/lib/query.cc
@@ -533,18 +533,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 2a3abfbd..f88f1c4e 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 11eb0a6b..4a464ecd 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -912,7 +912,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 ccb77b04..999493d7 100755
--- a/test/T560-lib-error.sh
+++ b/test/T560-lib-error.sh
@@ -302,9 +302,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:[hidden email]");
-       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
--
2.11.0

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|

[PATCH 6/6] lib: replace deprecated n_q_count_threads with status returning version

In reply to this post by David Bremner-2
This function was deprecated in notmuch 0.21.  We re-use the name for
a status returning version, and deprecate the _st name.
---
 bindings/python/notmuch/query.py |  2 +-
 bindings/ruby/query.c            |  2 +-
 lib/notmuch.h                    | 16 +++++++---------
 lib/query.cc                     | 12 ++++--------
 notmuch-count.c                  |  2 +-
 notmuch-search.c                 |  2 +-
 6 files changed, 15 insertions(+), 21 deletions(-)

diff --git a/bindings/python/notmuch/query.py b/bindings/python/notmuch/query.py
index 10fb6dcc..06c7b11b 100644
--- a/bindings/python/notmuch/query.py
+++ b/bindings/python/notmuch/query.py
@@ -204,7 +204,7 @@ class Query(object):
             raise NotmuchError(status)
         return count.value
 
-    _count_threads = nmlib.notmuch_query_count_threads_st
+    _count_threads = nmlib.notmuch_query_count_threads
     _count_threads.argtypes = [NotmuchQueryP, POINTER(c_uint)]
     _count_threads.restype = c_uint
 
diff --git a/bindings/ruby/query.c b/bindings/ruby/query.c
index b6edaef3..8b46d700 100644
--- a/bindings/ruby/query.c
+++ b/bindings/ruby/query.c
@@ -201,7 +201,7 @@ notmuch_rb_query_count_threads (VALUE self)
 
     Data_Get_Notmuch_Query (self, query);
 
-    status = notmuch_query_count_threads_st (query, &count);
+    status = notmuch_query_count_threads (query, &count);
     if (status)
  notmuch_rb_status_raise (status);
 
diff --git a/lib/notmuch.h b/lib/notmuch.h
index b79618f6..e692e9bb 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -1044,22 +1044,20 @@ notmuch_query_count_messages_st (notmuch_query_t *query, unsigned int *count);
  * 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_threads_st (notmuch_query_t *query, unsigned *count);
+notmuch_query_count_threads (notmuch_query_t *query, unsigned *count);
 
 /**
- * like notmuch_query_count_threads, but without a status return.
- *
- * May return 0 in case of errors.
+ * Deprecated alias for notmuch_query_count_threads
  *
- * @deprecated Deprecated as of libnotmuch 4.3 (notmuch 0.21). Please
+ * @deprecated Deprecated as of libnotmuch 5.0 (notmuch 0.25). Please
  * use notmuch_query_count_threads_st instead.
  */
-NOTMUCH_DEPRECATED(4,3)
-unsigned int
-notmuch_query_count_threads (notmuch_query_t *query);
+NOTMUCH_DEPRECATED(5,0)
+notmuch_status_t
+notmuch_query_count_threads_st (notmuch_query_t *query, unsigned *count);
 
 /**
  * Get the thread ID of 'thread'.
diff --git a/lib/query.cc b/lib/query.cc
index 25b953c7..6c692e8e 100644
--- a/lib/query.cc
+++ b/lib/query.cc
@@ -612,18 +612,14 @@ _notmuch_query_count_documents (notmuch_query_t *query, const char *type, unsign
     return NOTMUCH_STATUS_SUCCESS;
 }
 
-unsigned
-notmuch_query_count_threads (notmuch_query_t *query)
+notmuch_status_t
+notmuch_query_count_threads_st (notmuch_query_t *query, unsigned *count)
 {
-    notmuch_status_t status;
-    unsigned int count;
-
-    status = notmuch_query_count_threads_st (query, &count);
-    return status ? 0 : count;
+    return notmuch_query_count_threads (query, count);
 }
 
 notmuch_status_t
-notmuch_query_count_threads_st (notmuch_query_t *query, unsigned *count)
+notmuch_query_count_threads (notmuch_query_t *query, unsigned *count)
 {
     notmuch_messages_t *messages;
     GHashTable *hash;
diff --git a/notmuch-count.c b/notmuch-count.c
index 493be30f..cf80ee25 100644
--- a/notmuch-count.c
+++ b/notmuch-count.c
@@ -98,7 +98,7 @@ print_count (notmuch_database_t *notmuch, const char *query_str,
  printf ("%u", ucount);
  break;
     case OUTPUT_THREADS:
- status = notmuch_query_count_threads_st (query, &ucount);
+ status = notmuch_query_count_threads (query, &ucount);
  if (print_status_query ("notmuch count", query, status))
     return -1;
  printf ("%u", ucount);
diff --git a/notmuch-search.c b/notmuch-search.c
index 71218fdd..30722e86 100644
--- a/notmuch-search.c
+++ b/notmuch-search.c
@@ -123,7 +123,7 @@ do_search_threads (search_context_t *ctx)
     if (ctx->offset < 0) {
  unsigned count;
  notmuch_status_t status;
- status = notmuch_query_count_threads_st (ctx->query, &count);
+ status = notmuch_query_count_threads (ctx->query, &count);
  if (print_status_query ("notmuch search", ctx->query, status))
     return 1;
 
--
2.11.0

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 1/6] lib: bump SONAME to libnotmuch5

In reply to this post by David Bremner-2
David Bremner <[hidden email]> writes:

> We plan a sequence of ABI breaking changes. Put the SONAME change in a
> separate commit to make reordering easier.

I have pushed this series to master. I don't plan on bumping the SONAME
for every breakage before the next release, so if you are building
snapshots, be warned.

d
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch