diff options
| author | David Bremner <david@tethera.net> | 2015-09-27 12:31:58 -0300 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2015-10-05 19:51:08 -0300 |
| commit | e7b420a85446fa469df77e24c11f8afa06a2592e (patch) | |
| tree | 4073ad30ba4bdf7a20eb30a86b292db95105b4e8 /notmuch-count.c | |
| parent | 87ee9a53e36f395e73e16da12cb268a708147259 (diff) | |
cli: update to use new count API
Essentially replace each call to notmuch_count_* with the corresponding
_st call, followed by print_status_query.
Diffstat (limited to 'notmuch-count.c')
| -rw-r--r-- | notmuch-count.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/notmuch-count.c b/notmuch-count.c index be3e2365..0b6e6f54 100644 --- a/notmuch-count.c +++ b/notmuch-count.c @@ -75,9 +75,11 @@ print_count (notmuch_database_t *notmuch, const char *query_str, notmuch_query_t *query; size_t i; int count; + unsigned int ucount; unsigned long revision; const char *uuid; int ret = 0; + notmuch_status_t status; query = notmuch_query_create (notmuch, query_str); if (query == NULL) { @@ -90,10 +92,16 @@ print_count (notmuch_database_t *notmuch, const char *query_str, switch (output) { case OUTPUT_MESSAGES: - printf ("%u", notmuch_query_count_messages (query)); + status = notmuch_query_count_messages_st (query, &ucount); + if (print_status_query ("notmuch count", query, status)) + return -1; + printf ("%u", ucount); break; case OUTPUT_THREADS: - printf ("%u", notmuch_query_count_threads (query)); + status = notmuch_query_count_threads_st (query, &ucount); + if (print_status_query ("notmuch count", query, status)) + return -1; + printf ("%u", ucount); break; case OUTPUT_FILES: count = count_files (query); |
