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 MAwxGgdIHWCrQQAA0tVLHw (envelope-from ) for ; Fri, 05 Feb 2021 13:28:39 +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 kNb7FQdIHWAmOQAAB5/wlQ (envelope-from ) for ; Fri, 05 Feb 2021 13:28:39 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [IPv6:2607:5300:201:3100::1657]) (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 1614B9402BD for ; Fri, 5 Feb 2021 13:28:39 +0000 (UTC) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 61D041FD07; Fri, 5 Feb 2021 08:27:38 -0500 (EST) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by mail.notmuchmail.org (Postfix) with ESMTP id AFB151FBB6 for ; Fri, 5 Feb 2021 08:27:15 -0500 (EST) Received: by fethera.tethera.net (Postfix, from userid 1001) id A87846067F; Fri, 5 Feb 2021 08:27:15 -0500 (EST) Received: (nullmailer pid 3258421 invoked by uid 1000); Fri, 05 Feb 2021 13:27:02 -0000 From: David Bremner To: notmuch@notmuchmail.org Cc: David Bremner Subject: [PATCH 23/39] lib/config: add _notmuch_config_cache Date: Fri, 5 Feb 2021 09:26:38 -0400 Message-Id: <20210205132654.3258292-24-david@tethera.net> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210205132654.3258292-1-david@tethera.net> References: <20210205132654.3258292-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: BP5QLESI4Y3IE6NPLPT3HWN4I7HLAOCY X-Message-ID-Hash: BP5QLESI4Y3IE6NPLPT3HWN4I7HLAOCY 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: -0.93 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 1614B9402BD X-Spam-Score: -0.93 X-Migadu-Scanner: scn0.migadu.com X-TUID: TEFhRLBwNSBS 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 d14f5422..fe67ef41 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.30.0