diff options
| author | David Bremner <david@tethera.net> | 2021-01-30 13:30:18 -0400 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2021-03-20 07:33:25 -0300 |
| commit | aa59424812561f6d9e8c1d455d215349a90f676b (patch) | |
| tree | 21fd640613aeb9f531a2e45a63517ee346ad500f /lib/open.cc | |
| parent | 1be79fff50729eb68d71b3a2c3500f6d0ba2807b (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.cc | 16 |
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, - ¬much, &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; |
