From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id MMaCMfkcA2AXHwAA0tVLHw (envelope-from ) for ; Sat, 16 Jan 2021 17:06:01 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id YEKFLfkcA2BpLgAAB5/wlQ (envelope-from ) for ; Sat, 16 Jan 2021 17:06:01 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [144.217.243.247]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (2048 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 851A19404CE for ; Sat, 16 Jan 2021 17:06:01 +0000 (UTC) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 3907B2BF95; Sat, 16 Jan 2021 12:04:58 -0500 (EST) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by mail.notmuchmail.org (Postfix) with ESMTP id D83A52BF46 for ; Sat, 16 Jan 2021 12:04:32 -0500 (EST) Received: by fethera.tethera.net (Postfix, from userid 1001) id 9D52A5FF47; Sat, 16 Jan 2021 12:04:32 -0500 (EST) Received: (nullmailer pid 842425 invoked by uid 1000); Sat, 16 Jan 2021 17:04:15 -0000 From: David Bremner To: notmuch@notmuchmail.org Cc: David Bremner Subject: [PATCH 23/38] lib/config: add _notmuch_config_cache Date: Sat, 16 Jan 2021 13:03:51 -0400 Message-Id: <20210116170406.842014-24-david@tethera.net> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210116170406.842014-1-david@tethera.net> References: <20210116170406.842014-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: WDW7W7KOAPQ4Y2MKDNGLXWIIADAFKHJJ X-Message-ID-Hash: WDW7W7KOAPQ4Y2MKDNGLXWIIADAFKHJJ X-MailFrom: bremner@tethera.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -1.08 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 851A19404CE X-Spam-Score: -1.08 X-Migadu-Scanner: scn0.migadu.com X-TUID: oss9x5AB2UcC This is a simple convenience routine to cache a configuration value without writing it to the database. --- lib/config.cc | 5 +++++ lib/notmuch-private.h | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/lib/config.cc b/lib/config.cc index 1318cb52..57eedfb7 100644 --- a/lib/config.cc +++ b/lib/config.cc @@ -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); +} diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h index 961d50cf..5e0b42e3 100644 --- a/lib/notmuch-private.h +++ b/lib/notmuch-private.h @@ -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 -- 2.29.2