aboutsummaryrefslogtreecommitdiff
path: root/lib/database.cc
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2015-09-27 12:31:55 -0300
committerDavid Bremner <david@tethera.net>2015-10-05 19:39:11 -0300
commit65a6b86873a471bb87d30a8617a87857103cd8b6 (patch)
treee65ffd52109d7683f6efa794a23f0d66243cf23a /lib/database.cc
parent018e69f558c4ad36cefce42a11c2cdfe7270cb04 (diff)
lib: move query variable to function scope
This is a prelude to deallocating it (if necessary) on the error path.
Diffstat (limited to 'lib/database.cc')
-rw-r--r--lib/database.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/database.cc b/lib/database.cc
index 6d0e5a63..dcfad8cf 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -1372,6 +1372,7 @@ notmuch_database_upgrade (notmuch_database_t *notmuch,
enum _notmuch_features target_features, new_features;
notmuch_status_t status;
notmuch_private_status_t private_status;
+ notmuch_query_t *query = NULL;
unsigned int count = 0, total = 0;
status = _notmuch_database_ensure_writable (notmuch);
@@ -1408,7 +1409,7 @@ notmuch_database_upgrade (notmuch_database_t *notmuch,
if (new_features &
(NOTMUCH_FEATURE_FILE_TERMS | NOTMUCH_FEATURE_BOOL_FOLDER |
NOTMUCH_FEATURE_LAST_MOD)) {
- notmuch_query_t *query = notmuch_query_create (notmuch, "");
+ query = notmuch_query_create (notmuch, "");
total += notmuch_query_count_messages (query);
notmuch_query_destroy (query);
}
@@ -1436,11 +1437,12 @@ notmuch_database_upgrade (notmuch_database_t *notmuch,
if (new_features &
(NOTMUCH_FEATURE_FILE_TERMS | NOTMUCH_FEATURE_BOOL_FOLDER |
NOTMUCH_FEATURE_LAST_MOD)) {
- notmuch_query_t *query = notmuch_query_create (notmuch, "");
notmuch_messages_t *messages;
notmuch_message_t *message;
char *filename;
+ query = notmuch_query_create (notmuch, "");
+
/* XXX: this should use the _st version, but needs an error
path */
for (messages = notmuch_query_search_messages (query);