This is just code movement. A future commit will need the notmuch
object to exist for the path manipulation.
---
 lib/open.cc | 41 +++++++++++++++++++++--------------------
 1 file changed, 21 insertions(+), 20 deletions(-)

diff --git a/lib/open.cc b/lib/open.cc
index 12cbbbd0..ede367af 100644
--- a/lib/open.cc
+++ b/lib/open.cc
@@ -169,26 +169,6 @@ notmuch_database_open_with_config (const char 
*database_path,
     if ((status = _pre_open (config_path, profile, &key_file, &database_path, 
&message)))
        goto DONE;
 
-    if (! (notmuch_path = talloc_asprintf (local, "%s/%s", database_path, 
".notmuch"))) {
-       message = strdup ("Out of memory\n");
-       status = NOTMUCH_STATUS_OUT_OF_MEMORY;
-       goto DONE;
-    }
-
-    err = stat (notmuch_path, &st);
-    if (err) {
-       IGNORE_RESULT (asprintf (&message, "Error opening database at %s: %s\n",
-                                notmuch_path, strerror (errno)));
-       status = NOTMUCH_STATUS_FILE_ERROR;
-       goto DONE;
-    }
-
-    if (! (xapian_path = talloc_asprintf (local, "%s/%s", notmuch_path, 
"xapian"))) {
-       message = strdup ("Out of memory\n");
-       status = NOTMUCH_STATUS_OUT_OF_MEMORY;
-       goto DONE;
-    }
-
     /* Initialize the GLib type system and threads */
 #if ! GLIB_CHECK_VERSION (2, 35, 1)
     g_type_init ();
@@ -210,6 +190,27 @@ notmuch_database_open_with_config (const char 
*database_path,
     notmuch->writable_xapian_db = NULL;
     notmuch->atomic_nesting = 0;
     notmuch->view = 1;
+
+    if (! (notmuch_path = talloc_asprintf (local, "%s/%s", database_path, 
".notmuch"))) {
+       message = strdup ("Out of memory\n");
+       status = NOTMUCH_STATUS_OUT_OF_MEMORY;
+       goto DONE;
+    }
+
+    err = stat (notmuch_path, &st);
+    if (err) {
+       IGNORE_RESULT (asprintf (&message, "Error opening database at %s: %s\n",
+                                notmuch_path, strerror (errno)));
+       status = NOTMUCH_STATUS_FILE_ERROR;
+       goto DONE;
+    }
+
+    if (! (xapian_path = talloc_asprintf (local, "%s/%s", notmuch_path, 
"xapian"))) {
+       message = strdup ("Out of memory\n");
+       status = NOTMUCH_STATUS_OUT_OF_MEMORY;
+       goto DONE;
+    }
+
     try {
        std::string last_thread_id;
        std::string last_mod;
-- 
2.29.2
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org

Reply via email to