lib/open: use _finish_open in n_d_create_with_config

This avoids reading the configuration file twice.
This commit is contained in:
David Bremner 2021-01-30 13:30:18 -04:00
parent 1be79fff50
commit aa59424812

View file

@ -550,12 +550,16 @@ notmuch_database_create_with_config (const char *database_path,
goto DONE; goto DONE;
} }
/* XXX this reads the config file twice, which is a bit wasteful */ if (! (notmuch->xapian_path = talloc_asprintf (notmuch, "%s/%s", notmuch_path, "xapian"))) {
status = notmuch_database_open_with_config (database_path, status = NOTMUCH_STATUS_OUT_OF_MEMORY;
NOTMUCH_DATABASE_MODE_READ_WRITE, goto DONE;
config_path, }
profile,
&notmuch, &message); status = _finish_open (notmuch,
profile,
NOTMUCH_DATABASE_MODE_READ_WRITE,
key_file,
&message);
if (status) if (status)
goto DONE; goto DONE;