aboutsummaryrefslogtreecommitdiff
path: root/lib/open.cc
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2021-01-30 13:30:18 -0400
committerDavid Bremner <david@tethera.net>2021-03-20 07:33:25 -0300
commitaa59424812561f6d9e8c1d455d215349a90f676b (patch)
tree21fd640613aeb9f531a2e45a63517ee346ad500f /lib/open.cc
parent1be79fff50729eb68d71b3a2c3500f6d0ba2807b (diff)
lib/open: use _finish_open in n_d_create_with_config
This avoids reading the configuration file twice.
Diffstat (limited to 'lib/open.cc')
-rw-r--r--lib/open.cc16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/open.cc b/lib/open.cc
index cc099e51..09afd294 100644
--- a/lib/open.cc
+++ b/lib/open.cc
@@ -550,12 +550,16 @@ notmuch_database_create_with_config (const char *database_path,
goto DONE;
}
- /* XXX this reads the config file twice, which is a bit wasteful */
- status = notmuch_database_open_with_config (database_path,
- NOTMUCH_DATABASE_MODE_READ_WRITE,
- config_path,
- profile,
- &notmuch, &message);
+ if (! (notmuch->xapian_path = talloc_asprintf (notmuch, "%s/%s", notmuch_path, "xapian"))) {
+ status = NOTMUCH_STATUS_OUT_OF_MEMORY;
+ goto DONE;
+ }
+
+ status = _finish_open (notmuch,
+ profile,
+ NOTMUCH_DATABASE_MODE_READ_WRITE,
+ key_file,
+ &message);
if (status)
goto DONE;