unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Cc: David Bremner <david@tethera.net>
Subject: [PATCH 7/7] CLI/notmuch: make immutable tables const
Date: Thu, 13 May 2021 07:07:10 -0300	[thread overview]
Message-ID: <20210513100710.1460566-8-david@tethera.net> (raw)
In-Reply-To: <20210513100710.1460566-1-david@tethera.net>

Let the compiler enforce the immutability.
---
 notmuch.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/notmuch.c b/notmuch.c
index 9ca3a4be..d0a94fc2 100644
--- a/notmuch.c
+++ b/notmuch.c
@@ -139,7 +139,7 @@ notmuch_process_shared_indexing_options (notmuch_database_t *notmuch)
 }
 
 
-static command_t commands[] = {
+static const command_t commands[] = {
     { NULL, notmuch_command, NOTMUCH_COMMAND_CONFIG_CREATE | NOTMUCH_COMMAND_CONFIG_LOAD,
       "Notmuch main command." },
     { "setup", notmuch_setup_command, NOTMUCH_COMMAND_CONFIG_CREATE | NOTMUCH_COMMAND_CONFIG_LOAD,
@@ -189,7 +189,7 @@ typedef struct help_topic {
     const char *summary;
 } help_topic_t;
 
-static help_topic_t help_topics[] = {
+static const help_topic_t help_topics[] = {
     { "search-terms",
       "Common search term syntax." },
     { "hooks",
@@ -198,7 +198,7 @@ static help_topic_t help_topics[] = {
       "Message property conventions and documentation." },
 };
 
-static command_t *
+static const command_t *
 find_command (const char *name)
 {
     size_t i;
@@ -216,8 +216,8 @@ int notmuch_format_version;
 static void
 usage (FILE *out)
 {
-    command_t *command;
-    help_topic_t *topic;
+    const command_t *command;
+    const help_topic_t *topic;
     unsigned int i;
 
     fprintf (out,
@@ -308,8 +308,8 @@ exec_man (const char *page)
 static int
 _help_for (const char *topic_name)
 {
-    command_t *command;
-    help_topic_t *topic;
+    const command_t *command;
+    const help_topic_t *topic;
     unsigned int i;
 
     if (! topic_name) {
@@ -452,7 +452,7 @@ main (int argc, char *argv[])
     void *local;
     char *talloc_report;
     const char *command_name = NULL;
-    command_t *command;
+    const command_t *command;
     const char *config_file_name = NULL;
     notmuch_database_t *notmuch = NULL;
     int opt_index;
-- 
2.30.2

      parent reply	other threads:[~2021-05-13 10:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-13 10:07 static variable cleanup David Bremner
2021-05-13 10:07 ` [PATCH 1/7] lib: make glib initialization thread-safe David Bremner
2021-05-13 10:07 ` [PATCH 2/7] lib/generate_thread_id: move static buffer to notmuch_database_t David Bremner
2021-05-13 10:07 ` [PATCH 3/7] lib/message: mark flag2tag as const David Bremner
2021-05-13 10:07 ` [PATCH 4/7] CLI: centralize initialization in notmuch_client_init David Bremner
2021-05-13 10:07 ` [PATCH 5/7] CLI/config: make immutable tables const David Bremner
2021-05-13 10:07 ` [PATCH 6/7] CLI: make static message strings const David Bremner
2021-05-13 17:27   ` Tomi Ollila
2021-05-14 10:24     ` David Bremner
2021-05-14 14:39       ` Tomi Ollila
2021-05-13 10:07 ` David Bremner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210513100710.1460566-8-david@tethera.net \
    --to=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).