From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id oMyILYD6nGDZnwAAgWs5BA (envelope-from ) for ; Thu, 13 May 2021 12:08:00 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id YPUXKYD6nGBVcgAAbx9fmQ (envelope-from ) for ; Thu, 13 May 2021 10:08:00 +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) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 751172FC2F for ; Thu, 13 May 2021 12:08:00 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 045E127E2A; Thu, 13 May 2021 06:07:35 -0400 (EDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by mail.notmuchmail.org (Postfix) with ESMTP id F3AEB271E9 for ; Thu, 13 May 2021 06:07:20 -0400 (EDT) Received: by fethera.tethera.net (Postfix, from userid 1001) id E8F3D60018; Thu, 13 May 2021 06:07:20 -0400 (EDT) Received: (nullmailer pid 1460738 invoked by uid 1000); Thu, 13 May 2021 10:07:13 -0000 From: David Bremner To: notmuch@notmuchmail.org Cc: David Bremner Subject: [PATCH 5/7] CLI/config: make immutable tables const Date: Thu, 13 May 2021 07:07:08 -0300 Message-Id: <20210513100710.1460566-6-david@tethera.net> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210513100710.1460566-1-david@tethera.net> References: <20210513100710.1460566-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: 2L3TSI3VGF66ID3I5KPVJR7LOK5GMVZ3 X-Message-ID-Hash: 2L3TSI3VGF66ID3I5KPVJR7LOK5GMVZ3 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1620900480; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=0BwUNembsRTIHsGqh9JSX9cckx1PJ0gThTbu39GZYgY=; b=OjrIlFuMcbQVyR+fqOXh7Q9kjwXnzqikRw6Ilr2Jh1td8UDwGfCn0/mPaVh3v+abj6IboF Z6Af1KEDBAdF8q/n9nEGQNEC9PMRBRKaI7EKrMGCoAaAvTeWvU7HpXv0ej5eVOiiOqbSKF vMcN67owHt78rRf5Vi429I4mnsZd1PYKZ+YdRBnzRmepxBvbLiwJYETt3kK5xr5LZleGGj 71RSkpWg0OElKcD/aopUWKc92lC0X8m/paozjNPIbgXREthhn3E2OxrGkfimGnSk7jU3R/ omzLLovQYmMjJg0l5Vah68glgtWt9rEq56CJefqrUvRMpgWZDMc8uuBE0oQdcg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1620900480; a=rsa-sha256; cv=none; b=ZDqTcojGM/VnyzdDlcPI9FkFvMg+CmIq107dc1cfDzcBYzfTjnwOYPXzGKvqk+kq/ZShFZ a5a1k63l0nH9fOatLb99UfWLzbbNdqXgCSGXy90fH8VuiGZHDpSx90QnCUNUTbNntkwH2t 1YVN88lqunXuMhzJcsKVh5RmwHXNU2ZpiVEhNyYM2f+g4wte51X3L88IdDsP9eQkuC1R+k ls5/dVcAc1/Q40I/tMreBzfittyTneixfLIv8IY5gSJgdY2fJ1EZkOUfn3Lg1iabNi6Ajh HcnOhwVjScJrPYZOYJtE1j4Udsc5aa2kUKmbB9iNOBsk2BAdoPOjO34lLEqg9w== ARC-Authentication-Results: i=1; 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-Spam-Score: 0.46 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: 751172FC2F X-Spam-Score: 0.46 X-Migadu-Scanner: scn0.migadu.com X-TUID: mRNYLkst2rrG Let the compiler help us catch bugs. --- notmuch-config.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/notmuch-config.c b/notmuch-config.c index d9390c4d..3430a3d3 100644 --- a/notmuch-config.c +++ b/notmuch-config.c @@ -32,7 +32,7 @@ static const char toplevel_config_comment[] = "\n" " For more information about notmuch, see https://notmuchmail.org"; -struct config_group { +static const struct config_group { const char *group_name; const char *comment; } group_comment_table [] = { @@ -512,14 +512,14 @@ typedef struct config_key { bool (*validate)(const char *); } config_key_info_t; -static struct config_key +static const struct config_key config_key_table[] = { { "index.decrypt", false, NULL }, { "index.header.", true, validate_field_name }, { "query.", true, NULL }, }; -static config_key_info_t * +static const config_key_info_t * _config_key_info (const char *item) { for (size_t i = 0; i < ARRAY_SIZE (config_key_table); i++) { @@ -583,7 +583,7 @@ notmuch_config_command_set (notmuch_database_t *notmuch, int argc, char *argv[]) { char *group, *key; - config_key_info_t *key_info; + const config_key_info_t *key_info; notmuch_conffile_t *config; bool update_database = false; int opt_index, ret; -- 2.30.2