changes since the last round [1]

- remove unused variable
- fix the internal usage of n_d_open to use _verbose version
- revert the hiding of query debugging.

[1]: id:1419717937-1108-2-git-send-email-david at tethera.net

diff --git a/lib/database.cc b/lib/database.cc
index 16cd940..b144885 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -377,7 +377,6 @@ _notmuch_database_log (notmuch_database_t *notmuch,
                      ...)
 {
     va_list va_args;
-    const char *message;

     va_start (va_args, format);

@@ -693,9 +692,9 @@ notmuch_database_create_verbose (const char *path,
        goto DONE;
     }

-    status = notmuch_database_open (path,
-                                   NOTMUCH_DATABASE_MODE_READ_WRITE,
-                                   &notmuch);
+    status = notmuch_database_open_verbose (path,
+                                           NOTMUCH_DATABASE_MODE_READ_WRITE,
+                                           &notmuch, &message);
     if (status)
        goto DONE;

@@ -1101,13 +1100,18 @@ notmuch_database_compact (const char *path,
     notmuch_database_t *notmuch = NULL;
     struct stat statbuf;
     notmuch_bool_t keep_backup;
+    char *message = NULL;

     local = talloc_new (NULL);
     if (! local)
        return NOTMUCH_STATUS_OUT_OF_MEMORY;

-    ret = notmuch_database_open (path, NOTMUCH_DATABASE_MODE_READ_WRITE, 
&notmuch);
+    ret = notmuch_database_open_verbose (path,
+                                        NOTMUCH_DATABASE_MODE_READ_WRITE,
+                                        &notmuch,
+                                        &message);
     if (ret) {
+       if (status_cb) status_cb (message, closure);
        goto DONE;
     }

diff --git a/lib/query.cc b/lib/query.cc
index 2e20ab2..9ed420c 100644
--- a/lib/query.cc
+++ b/lib/query.cc
@@ -78,7 +78,7 @@ notmuch_query_create (notmuch_database_t *notmuch,
     notmuch_query_t *query;

     if (_debug_query ())
-       _notmuch_database_log (notmuch, "Query string is:\n%s\n", query_string);
+       fprintf (stderr, "Query string is:\n%s\n", query_string);

     query = talloc (notmuch, notmuch_query_t);
     if (unlikely (query == NULL))
@@ -266,9 +266,9 @@ notmuch_query_search_messages (notmuch_query_t *query)
        }

        if (_debug_query ()) {
-           _notmuch_database_log (notmuch, "Exclude query is:\n%s\n",
+           fprintf (stderr, "Exclude query is:\n%s\n",
                     exclude_query.get_description ().c_str ());
-           _notmuch_database_log (notmuch, "Final query is:\n%s\n",
+           fprintf (stderr, "Final query is:\n%s\n",
                     final_query.get_description ().c_str ());
        }

@@ -549,9 +549,9 @@ notmuch_query_count_messages (notmuch_query_t *query)
        enquire.set_docid_order(Xapian::Enquire::ASCENDING);

        if (_debug_query ()) {
-           _notmuch_database_log (notmuch, "Exclude query is:\n%s\n",
+           fprintf (stderr, "Exclude query is:\n%s\n",
                     exclude_query.get_description ().c_str ());
-           _notmuch_database_log (notmuch, "Final query is:\n%s\n",
+           fprintf (stderr, "Final query is:\n%s\n",
                     final_query.get_description ().c_str ());
        }


 lib/database.cc | 14 +++++++++-----
 lib/query.cc    | 10 +++++-----
 2 files changed, 14 insertions(+), 10 deletions(-)

Reply via email to