diff options
| author | David Bremner <david@tethera.net> | 2015-09-27 12:31:57 -0300 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2015-10-05 19:44:07 -0300 |
| commit | 87ee9a53e36f395e73e16da12cb268a708147259 (patch) | |
| tree | c73d4e86d385edd8337cf047c0d3707f01cc0c02 /lib/database.cc | |
| parent | 81bd41c7cb59a8d70932e6bdbee6e1e2cde5477f (diff) | |
lib: add versions of n_q_count_{message,threads} with status return
Although I think it's a pretty bad idea to continue using the old API,
this allows both a more gentle transition for clients of the library,
and allows us to break one monolithic change into a series
Diffstat (limited to 'lib/database.cc')
| -rw-r--r-- | lib/database.cc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/database.cc b/lib/database.cc index dcfad8cf..f39d4485 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -1410,8 +1410,15 @@ notmuch_database_upgrade (notmuch_database_t *notmuch, (NOTMUCH_FEATURE_FILE_TERMS | NOTMUCH_FEATURE_BOOL_FOLDER | NOTMUCH_FEATURE_LAST_MOD)) { query = notmuch_query_create (notmuch, ""); - total += notmuch_query_count_messages (query); + unsigned msg_count; + + status = notmuch_query_count_messages_st (query, &msg_count); + if (status) + goto DONE; + + total += msg_count; notmuch_query_destroy (query); + query = NULL; } if (new_features & NOTMUCH_FEATURE_DIRECTORY_DOCS) { t_end = db->allterms_end ("XTIMESTAMP"); @@ -1492,6 +1499,7 @@ notmuch_database_upgrade (notmuch_database_t *notmuch, } notmuch_query_destroy (query); + query = NULL; } /* Perform per-directory upgrades. */ @@ -1612,6 +1620,9 @@ notmuch_database_upgrade (notmuch_database_t *notmuch, sigaction (SIGALRM, &action, NULL); } + if (query) + notmuch_query_destroy (query); + talloc_free (local); return status; } |
