[PATCH 12/22] lib/open: use _finish_open in n_d_create_with_config

2021-03-14 Thread David Bremner
This avoids reading the configuration file twice.
---
 lib/open.cc | 19 +++
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/lib/open.cc b/lib/open.cc
index 7673e875..54e71fec 100644
--- a/lib/open.cc
+++ b/lib/open.cc
@@ -442,8 +442,7 @@ notmuch_database_open_with_config (const char 
*database_path,
 if (status)
goto DONE;
 
-if (! (notmuch->xapian_path = talloc_asprintf (local, "%s/%s", 
notmuch_path, "xapian"))) {
-   message = strdup ("Out of memory\n");
+if (! (notmuch->xapian_path = talloc_asprintf (notmuch, "%s/%s", 
notmuch_path, "xapian"))) {
status = NOTMUCH_STATUS_OUT_OF_MEMORY;
goto DONE;
 }
@@ -550,12 +549,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,
-   , );
+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,
+  );
 if (status)
goto DONE;
 
-- 
2.30.1
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH 12/22] lib/open: use _finish_open in n_d_create_with_config

2021-03-07 Thread David Bremner
This avoids reading the configuration file twice.
---
 lib/open.cc | 19 +++
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/lib/open.cc b/lib/open.cc
index d8e69319..e59cfcdc 100644
--- a/lib/open.cc
+++ b/lib/open.cc
@@ -439,8 +439,7 @@ notmuch_database_open_with_config (const char 
*database_path,
 if (status)
goto DONE;
 
-if (! (notmuch->xapian_path = talloc_asprintf (local, "%s/%s", 
notmuch_path, "xapian"))) {
-   message = strdup ("Out of memory\n");
+if (! (notmuch->xapian_path = talloc_asprintf (notmuch, "%s/%s", 
notmuch_path, "xapian"))) {
status = NOTMUCH_STATUS_OUT_OF_MEMORY;
goto DONE;
 }
@@ -545,12 +544,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,
-   , );
+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,
+  );
 if (status)
goto DONE;
 
-- 
2.30.1
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH 12/22] lib/open: use _finish_open in n_d_create_with_config

2021-03-04 Thread David Bremner
This avoids reading the configuration file twice.
---
 lib/open.cc | 19 +++
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/lib/open.cc b/lib/open.cc
index d052f95d..ebf70c15 100644
--- a/lib/open.cc
+++ b/lib/open.cc
@@ -429,8 +429,7 @@ notmuch_database_open_with_config (const char 
*database_path,
 if (status)
 goto DONE;
 
-if (! (notmuch->xapian_path = talloc_asprintf (local, "%s/%s", 
notmuch_path, "xapian"))) {
-   message = strdup ("Out of memory\n");
+if (! (notmuch->xapian_path = talloc_asprintf (notmuch, "%s/%s", 
notmuch_path, "xapian"))) {
status = NOTMUCH_STATUS_OUT_OF_MEMORY;
goto DONE;
 }
@@ -531,12 +530,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,
-   , );
+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,
+  );
 if (status)
goto DONE;
 
-- 
2.30.1
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org