aboutsummaryrefslogtreecommitdiff
path: root/lib/config.cc
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2020-07-26 20:31:36 -0300
committerDavid Bremner <david@tethera.net>2020-07-28 08:47:58 -0300
commita09293793f43b93b7008dd361b192199ad528fca (patch)
tree3655943388b32c142f8783df12368863d5783b18 /lib/config.cc
parentd7d4c729ab3b74eaaebe64cb8c7383b0ea06cec0 (diff)
lib: replace use of static_cast for writable databases
static_cast is a bit tricky to understand and error prone, so add a second pointer to (potentially the same) Xapian database object that we know has the right subclass.
Diffstat (limited to 'lib/config.cc')
-rw-r--r--lib/config.cc4
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/config.cc b/lib/config.cc
index 20036471..dae0ff0e 100644
--- a/lib/config.cc
+++ b/lib/config.cc
@@ -45,15 +45,13 @@ notmuch_database_set_config (notmuch_database_t *notmuch,
const char *value)
{
notmuch_status_t status;
- Xapian::WritableDatabase *db;
status = _notmuch_database_ensure_writable (notmuch);
if (status)
return status;
try {
- db = static_cast <Xapian::WritableDatabase *> (notmuch->xapian_db);
- db->set_metadata (CONFIG_PREFIX + key, value);
+ notmuch->writable_xapian_db->set_metadata (CONFIG_PREFIX + key, value);
} catch (const Xapian::Error &error) {
status = NOTMUCH_STATUS_XAPIAN_EXCEPTION;
notmuch->exception_reported = true;