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 qExMKChV8l+xbQAA0tVLHw (envelope-from ) for ; Sun, 03 Jan 2021 23:37:12 +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 yB86JChV8l8vEAAAB5/wlQ (envelope-from ) for ; Sun, 03 Jan 2021 23:37:12 +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 24F519403A4 for ; Sun, 3 Jan 2021 23:37:12 +0000 (UTC) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 9239D29D95; Sun, 3 Jan 2021 18:36:31 -0500 (EST) Received: from fethera.tethera.net (fethera.tethera.net [IPv6:2607:5300:60:c5::1]) by mail.notmuchmail.org (Postfix) with ESMTP id 66BDE29D4A for ; Sun, 3 Jan 2021 18:36:08 -0500 (EST) Received: by fethera.tethera.net (Postfix, from userid 1001) id 543A85FF47; Sun, 3 Jan 2021 18:36:08 -0500 (EST) Received: (nullmailer pid 126242 invoked by uid 1000); Sun, 03 Jan 2021 23:35:56 -0000 From: David Bremner To: notmuch@notmuchmail.org Cc: David Bremner Subject: [PATCH 24/36] lib/config: add _notmuch_config_cache Date: Sun, 3 Jan 2021 19:35:35 -0400 Message-Id: <20210103233547.122707-25-david@tethera.net> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210103233547.122707-1-david@tethera.net> References: <20210103233547.122707-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: MXGBCS5LFDTN2GZDRHLSKHUC75RW2SUX X-Message-ID-Hash: MXGBCS5LFDTN2GZDRHLSKHUC75RW2SUX 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.06 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: 24F519403A4 X-Spam-Score: -1.06 X-Migadu-Scanner: scn1.migadu.com X-TUID: r7VIt5EGONxu 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 17af4b46..99fcda1f 100644 --- a/lib/config.cc +++ b/lib/config.cc @@ -439,3 +439,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