]> git.cworth.org Git - notmuch/commitdiff
lib/config: add _notmuch_config_cache
authorDavid Bremner <david@tethera.net>
Thu, 24 Dec 2020 03:35:42 +0000 (23:35 -0400)
committerDavid Bremner <david@tethera.net>
Sat, 6 Feb 2021 23:32:29 +0000 (19:32 -0400)
This is a simple convenience routine to cache a configuration value
without writing it to the database.

lib/config.cc
lib/notmuch-private.h

index d14f5422fa947e365dace7e06995f7921641c1c9..fe67ef416a0d08083281d4890ed8d473155b85a4 100644 (file)
@@ -464,3 +464,8 @@ notmuch_config_set (notmuch_database_t *notmuch, notmuch_config_key_t key, const
 
     return notmuch_database_set_config (notmuch, _notmuch_config_key_to_string (key), val);
 }
+
+void
+_notmuch_config_cache (notmuch_database_t *notmuch, notmuch_config_key_t key, const char *val) {
+    _notmuch_string_map_set (notmuch->config, _notmuch_config_key_to_string (key), val);
+}
index 961d50cfd365c75f11960c4dbadcc707b03cce33..5e0b42e3e0af742da055a8f35b882f7ed15b8a2e 100644 (file)
@@ -713,6 +713,10 @@ _notmuch_config_load_from_file (notmuch_database_t * db, GKeyFile *file);
 
 notmuch_status_t
 _notmuch_config_load_defaults (notmuch_database_t * db);
+
+void
+_notmuch_config_cache (notmuch_database_t *db, notmuch_config_key_t key, const char* val);
+
 NOTMUCH_END_DECLS
 
 #ifdef __cplusplus