From: David Bremner Date: Sat, 30 Jan 2021 17:30:18 +0000 (-0400) Subject: lib/open: use _finish_open in n_d_create_with_config X-Git-Tag: 0.32_rc0~49 X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=commitdiff_plain;h=aa59424812561f6d9e8c1d455d215349a90f676b lib/open: use _finish_open in n_d_create_with_config This avoids reading the configuration file twice. --- 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;