summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--addrbook.c2
-rw-r--r--browser.c2
-rw-r--r--charset.c6
-rw-r--r--color.c6
-rw-r--r--compose.c4
-rw-r--r--crypt-gpgme.c4
-rw-r--r--curs_lib.c4
-rw-r--r--curs_main.c2
-rw-r--r--date.c4
-rw-r--r--enter.c2
-rw-r--r--functions.h26
-rw-r--r--globals.h12
-rw-r--r--handler.c6
-rw-r--r--help.c14
-rw-r--r--imap/auth.c4
-rw-r--r--imap/command.c2
-rw-r--r--imap/message.c2
-rw-r--r--imap/utf7.c4
-rw-r--r--imap/util.c3
-rw-r--r--init.c17
-rw-r--r--init.h2
-rw-r--r--keymap.c24
-rw-r--r--keymap.h31
-rw-r--r--lib.c6
-rw-r--r--mapping.h6
-rw-r--r--mime.h6
-rw-r--r--mutt_ssl.c2
-rw-r--r--pager.c4
-rw-r--r--parse.c2
-rw-r--r--pattern.c6
-rw-r--r--pgpkey.c2
-rw-r--r--pgpmicalg.c2
-rw-r--r--pop_auth.c4
-rw-r--r--postpone.c2
-rw-r--r--protos.h2
-rw-r--r--query.c2
-rw-r--r--recvattach.c2
-rw-r--r--remailer.c2
-rw-r--r--rfc2047.c2
-rw-r--r--rfc822.c2
-rw-r--r--rfc822.h2
-rw-r--r--sendlib.c2
-rw-r--r--url.c2
43 files changed, 122 insertions, 121 deletions
diff --git a/addrbook.c b/addrbook.c
index 7d82cf57..8767a00f 100644
--- a/addrbook.c
+++ b/addrbook.c
@@ -33,7 +33,7 @@
#define RSORT(x) (SortAlias & SORT_REVERSE) ? -x : x
-static struct mapping_t AliasHelp[] = {
+static const struct mapping_t AliasHelp[] = {
{ N_("Exit"), OP_EXIT },
{ N_("Del"), OP_DELETE },
{ N_("Undel"), OP_UNDELETE },
diff --git a/browser.c b/browser.c
index 3cc24939..cda4900a 100644
--- a/browser.c
+++ b/browser.c
@@ -42,7 +42,7 @@
#include <errno.h>
#include <locale.h>
-static struct mapping_t FolderHelp[] = {
+static const struct mapping_t FolderHelp[] = {
{ N_("Exit"), OP_EXIT },
{ N_("Chdir"), OP_CHANGE_DIRECTORY },
{ N_("Mask"), OP_ENTER_MASK },
diff --git a/charset.c b/charset.c
index fd011a49..9dd278ee 100644
--- a/charset.c
+++ b/charset.c
@@ -50,10 +50,10 @@
* a preferred MIME name is given.
*/
-static struct
+static const const struct
{
- char *key;
- char *pref;
+ const char *key;
+ const char *pref;
}
PreferredMIMENames[] =
{
diff --git a/color.c b/color.c
index b39957f0..db8266d0 100644
--- a/color.c
+++ b/color.c
@@ -55,7 +55,7 @@ typedef struct color_list
static COLOR_LIST *ColorList = NULL;
static int UserColors = 0;
-static struct mapping_t Colors[] =
+static const struct mapping_t Colors[] =
{
{ "black", COLOR_BLACK },
{ "blue", COLOR_BLUE },
@@ -73,7 +73,7 @@ static struct mapping_t Colors[] =
#endif /* HAVE_COLOR */
-static struct mapping_t Fields[] =
+static const struct mapping_t Fields[] =
{
{ "hdrdefault", MT_COLOR_HDEFAULT },
{ "quoted", MT_COLOR_QUOTED },
@@ -159,7 +159,7 @@ void ci_start_color (void)
#ifdef USE_SLANG_CURSES
static char *get_color_name (char *dest, size_t destlen, int val)
{
- static char * missing[3] = {"brown", "lightgray", "default"};
+ static const char * const missing[3] = {"brown", "lightgray", "default"};
int i;
switch (val)
diff --git a/compose.c b/compose.c
index 3b7cb173..edda021d 100644
--- a/compose.c
+++ b/compose.c
@@ -74,7 +74,7 @@ enum
#define TITLE_FMT "%10s" /* Used for Prompts, which are ASCII */
#define W (COLS - HDR_XOFFSET)
-static char *Prompts[] =
+static const char * const Prompts[] =
{
"From: ",
"To: ",
@@ -85,7 +85,7 @@ static char *Prompts[] =
"Fcc: "
};
-static struct mapping_t ComposeHelp[] = {
+static const struct mapping_t ComposeHelp[] = {
{ N_("Send"), OP_COMPOSE_SEND_MESSAGE },
{ N_("Abort"), OP_EXIT },
{ "To", OP_COMPOSE_EDIT_TO },
diff --git a/crypt-gpgme.c b/crypt-gpgme.c
index b1da88bf..3ef629db 100644
--- a/crypt-gpgme.c
+++ b/crypt-gpgme.c
@@ -129,7 +129,7 @@ static char *current_sender = NULL;
* General helper functions.
*/
-/* return true when S pints to a didgit or letter. */
+/* return true when s points to a digit or letter. */
static int
digit_or_letter (const unsigned char *s)
{
@@ -2923,7 +2923,7 @@ print_dn_part (FILE *fp, struct dn_array_s *dn, const char *key)
static void
print_dn_parts (FILE *fp, struct dn_array_s *dn)
{
- const char *stdpart[] = {
+ static const char * const stdpart[] = {
"CN", "OU", "O", "STREET", "L", "ST", "C", NULL
};
int any=0, any2=0, i;
diff --git a/curs_lib.c b/curs_lib.c
index 7f88cc93..29114906 100644
--- a/curs_lib.c
+++ b/curs_lib.c
@@ -129,7 +129,7 @@ event_t mutt_getch (void)
return (ch == ctrl ('G') ? err : ret);
}
-int _mutt_get_field (/* const */ char *field, char *buf, size_t buflen, int complete, int multiple, char ***files, int *numfiles)
+int _mutt_get_field (const char *field, char *buf, size_t buflen, int complete, int multiple, char ***files, int *numfiles)
{
int ret;
int x, y;
@@ -139,7 +139,7 @@ int _mutt_get_field (/* const */ char *field, char *buf, size_t buflen, int comp
do
{
CLEARLINE (LINES-1);
- addstr (field);
+ addstr ((char *)field); /* cast to get around bad prototypes */
mutt_refresh ();
getyx (stdscr, y, x);
ret = _mutt_enter_string (buf, buflen, y, x, complete, multiple, files, numfiles, es);
diff --git a/curs_main.c b/curs_main.c
index dd2ac398..302082b4 100644
--- a/curs_main.c
+++ b/curs_main.c
@@ -401,7 +401,7 @@ static void resort_index (MUTTMENU *menu)
menu->redraw = REDRAW_INDEX | REDRAW_STATUS;
}
-static struct mapping_t IndexHelp[] = {
+static const struct mapping_t IndexHelp[] = {
{ N_("Quit"), OP_QUIT },
{ N_("Del"), OP_DELETE },
{ N_("Undel"), OP_UNDELETE },
diff --git a/date.c b/date.c
index a2f00048..0cd83122 100644
--- a/date.c
+++ b/date.c
@@ -69,7 +69,7 @@ time_t mutt_mktime (struct tm *t, int local)
{
time_t g;
- static int AccumDaysPerMonth[12] = {
+ static const int AccumDaysPerMonth[12] = {
0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334
};
@@ -118,7 +118,7 @@ static int isLeapYearFeb (struct tm *tm)
void mutt_normalize_time (struct tm *tm)
{
- static char DaysPerMonth[12] = {
+ static const char DaysPerMonth[12] = {
31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
};
int nLeap;
diff --git a/enter.c b/enter.c
index 9f8a45e6..ac083f5c 100644
--- a/enter.c
+++ b/enter.c
@@ -191,7 +191,7 @@ static void replace_part (ENTER_STATE *state, size_t from, char *buf)
*/
static inline int is_shell_char(wchar_t ch)
{
- static wchar_t shell_chars[] = L"<>&()$?*;{}| "; /* ! not included because it can be part of a pathname in Mutt */
+ static const wchar_t shell_chars[] = L"<>&()$?*;{}| "; /* ! not included because it can be part of a pathname in Mutt */
return wcschr(shell_chars, ch) != NULL;
}
diff --git a/functions.h b/functions.h
index e8beacb4..7a1c5a9f 100644
--- a/functions.h
+++ b/functions.h
@@ -38,7 +38,7 @@
# include "doc/makedoc-defs.h"
#endif
-struct binding_t OpGeneric[] = { /* map: generic */
+const struct binding_t OpGeneric[] = { /* map: generic */
/*
** <para>
** The <emphasis>generic</emphasis> menu is not a real menu, but specifies common functions
@@ -82,7 +82,7 @@ struct binding_t OpGeneric[] = { /* map: generic */
{ NULL, 0, NULL }
};
-struct binding_t OpMain[] = { /* map: index */
+const struct binding_t OpMain[] = { /* map: index */
{ "create-alias", OP_CREATE_ALIAS, "a" },
{ "bounce-message", OP_BOUNCE_MESSAGE, "b" },
{ "break-thread", OP_MAIN_BREAK_THREAD, "#" },
@@ -172,7 +172,7 @@ struct binding_t OpMain[] = { /* map: index */
{ NULL, 0, NULL }
};
-struct binding_t OpPager[] = { /* map: pager */
+const struct binding_t OpPager[] = { /* map: pager */
{ "break-thread", OP_MAIN_BREAK_THREAD, "#" },
{ "create-alias", OP_CREATE_ALIAS, "a" },
{ "bounce-message", OP_BOUNCE_MESSAGE, "b" },
@@ -275,7 +275,7 @@ struct binding_t OpPager[] = { /* map: pager */
{ NULL, 0, NULL }
};
-struct binding_t OpAttach[] = { /* map: attachment */
+const struct binding_t OpAttach[] = { /* map: attachment */
{ "bounce-message", OP_BOUNCE_MESSAGE, "b" },
{ "display-toggle-weed", OP_DISPLAY_HEADERS, "h" },
{ "edit-type", OP_EDIT_TYPE, "\005" },
@@ -301,7 +301,7 @@ struct binding_t OpAttach[] = { /* map: attachment */
{ NULL, 0, NULL }
};
-struct binding_t OpCompose[] = { /* map: compose */
+const struct binding_t OpCompose[] = { /* map: compose */
{ "attach-file", OP_COMPOSE_ATTACH_FILE, "a" },
{ "attach-message", OP_COMPOSE_ATTACH_MESSAGE, "A" },
{ "edit-bcc", OP_COMPOSE_EDIT_BCC, "b" },
@@ -351,13 +351,13 @@ struct binding_t OpCompose[] = { /* map: compose */
{ NULL, 0, NULL }
};
-struct binding_t OpPost[] = { /* map: postpone */
+const struct binding_t OpPost[] = { /* map: postpone */
{ "delete-entry", OP_DELETE, "d" },
{ "undelete-entry", OP_UNDELETE, "u" },
{ NULL, 0, NULL }
};
-struct binding_t OpAlias[] = { /* map: alias */
+const struct binding_t OpAlias[] = { /* map: alias */
{ "delete-entry", OP_DELETE, "d" },
{ "undelete-entry", OP_UNDELETE, "u" },
{ NULL, 0, NULL }
@@ -365,7 +365,7 @@ struct binding_t OpAlias[] = { /* map: alias */
/* The file browser */
-struct binding_t OpBrowser[] = { /* map: browser */
+const struct binding_t OpBrowser[] = { /* map: browser */
{ "change-dir", OP_CHANGE_DIRECTORY, "c" },
{ "display-filename", OP_BROWSER_TELL, "@" },
{ "enter-mask", OP_ENTER_MASK, "m" },
@@ -388,7 +388,7 @@ struct binding_t OpBrowser[] = { /* map: browser */
};
/* External Query Menu */
-struct binding_t OpQuery[] = { /* map: query */
+const struct binding_t OpQuery[] = { /* map: query */
{ "create-alias", OP_CREATE_ALIAS, "a" },
{ "mail", OP_MAIL, "m" },
{ "query", OP_QUERY, "Q" },
@@ -396,7 +396,7 @@ struct binding_t OpQuery[] = { /* map: query */
{ NULL, 0, NULL }
};
-struct binding_t OpEditor[] = { /* map: editor */
+const struct binding_t OpEditor[] = { /* map: editor */
{ "bol", OP_EDITOR_BOL, "\001" },
{ "backward-char", OP_EDITOR_BACKWARD_CHAR, "\002" },
{ "backward-word", OP_EDITOR_BACKWARD_WORD, "\033b"},
@@ -424,7 +424,7 @@ struct binding_t OpEditor[] = { /* map: editor */
-struct binding_t OpPgp[] = { /* map: pgp */
+const struct binding_t OpPgp[] = { /* map: pgp */
{ "verify-key", OP_VERIFY_KEY, "c" },
{ "view-name", OP_VIEW_ID, "%" },
{ NULL, 0, NULL }
@@ -434,7 +434,7 @@ struct binding_t OpPgp[] = { /* map: pgp */
/* When using the GPGME based backend we have some useful functions
for the SMIME menu. */
-struct binding_t OpSmime[] = { /* map: smime */
+const struct binding_t OpSmime[] = { /* map: smime */
#ifdef CRYPT_BACKEND_GPGME
{ "verify-key", OP_VERIFY_KEY, "c" },
{ "view-name", OP_VIEW_ID, "%" },
@@ -445,7 +445,7 @@ struct binding_t OpSmime[] = { /* map: smime */
#ifdef MIXMASTER
-struct binding_t OpMix[] = { /* map: mixmaster */
+const struct binding_t OpMix[] = { /* map: mixmaster */
{ "accept", OP_MIX_USE, M_ENTER_S },
{ "append", OP_MIX_APPEND, "a" },
{ "insert", OP_MIX_INSERT, "i" },
diff --git a/globals.h b/globals.h
index 5aec5300..6fefe5b0 100644
--- a/globals.h
+++ b/globals.h
@@ -266,14 +266,14 @@ WHERE char *SmimeGetCertEmailCommand;
#ifdef MAIN_C
-const char *Weekdays[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
-const char *Months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "ERR" };
+const char * const Weekdays[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
+const char * const Months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "ERR" };
-const char *BodyTypes[] = { "x-unknown", "audio", "application", "image", "message", "model", "multipart", "text", "video" };
-const char *BodyEncodings[] = { "x-unknown", "7bit", "8bit", "quoted-printable", "base64", "binary", "x-uuencoded" };
+const char * const BodyTypes[] = { "x-unknown", "audio", "application", "image", "message", "model", "multipart", "text", "video" };
+const char * const BodyEncodings[] = { "x-unknown", "7bit", "8bit", "quoted-printable", "base64", "binary", "x-uuencoded" };
#else
-extern const char *Weekdays[];
-extern const char *Months[];
+extern const char * const Weekdays[];
+extern const char * const Months[];
#endif
#ifdef MAIN_C
diff --git a/handler.c b/handler.c
index 39b7979b..13c89ecc 100644
--- a/handler.c
+++ b/handler.c
@@ -43,7 +43,7 @@
typedef int (*handler_t) (BODY *, STATE *);
-int Index_hex[128] = {
+const int Index_hex[128] = {
-1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
-1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
-1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
@@ -54,7 +54,7 @@ int Index_hex[128] = {
-1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1
};
-int Index_64[128] = {
+const int Index_64[128] = {
-1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
-1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
-1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,62, -1,-1,-1,63,
@@ -434,7 +434,7 @@ enum { RICH_PARAM=0, RICH_BOLD, RICH_UNDERLINE, RICH_ITALIC, RICH_NOFILL,
RICH_INDENT, RICH_INDENT_RIGHT, RICH_EXCERPT, RICH_CENTER, RICH_FLUSHLEFT,
RICH_FLUSHRIGHT, RICH_COLOR, RICH_LAST_TAG };
-static struct {
+static const struct {
const wchar_t *tag_name;
int index;
} EnrichedTags[] = {
diff --git a/help.c b/help.c
index 6d54059f..c1d2d0c6 100644
--- a/help.c
+++ b/help.c
@@ -31,10 +31,10 @@
#include <ctype.h>
#include <string.h>
-static struct binding_t *help_lookupFunction (int op, int menu)
+static const struct binding_t *help_lookupFunction (int op, int menu)
{
int i;
- struct binding_t *map;
+ const struct binding_t *map;
if (menu != MENU_PAGER)
{
@@ -66,7 +66,7 @@ void mutt_make_help (char *d, size_t dlen, char *txt, int menu, int op)
}
char *
-mutt_compile_help (char *buf, size_t buflen, int menu, struct mapping_t *items)
+mutt_compile_help (char *buf, size_t buflen, int menu, const struct mapping_t *items)
{
int i;
size_t len;
@@ -282,7 +282,7 @@ static void format_line (FILE *f, int ismacro,
static void dump_menu (FILE *f, int menu)
{
struct keymap_t *map;
- struct binding_t *b;
+ const struct binding_t *b;
char buf[SHORT_STRING];
/* browse through the keymap table */
@@ -318,7 +318,7 @@ static int is_bound (struct keymap_t *map, int op)
}
static void dump_unbound (FILE *f,
- struct binding_t *funcs,
+ const struct binding_t *funcs,
struct keymap_t *map,
struct keymap_t *aux)
{
@@ -336,9 +336,9 @@ void mutt_help (int menu)
{
char t[_POSIX_PATH_MAX];
char buf[SHORT_STRING];
- char *desc;
+ const char *desc;
FILE *f;
- struct binding_t *funcs;
+ const struct binding_t *funcs;
mutt_mktemp (t, sizeof (t));
diff --git a/imap/auth.c b/imap/auth.c
index 6ac29251..8a7f0789 100644
--- a/imap/auth.c
+++ b/imap/auth.c
@@ -28,7 +28,7 @@
#include "imap_private.h"
#include "auth.h"
-static imap_auth_t imap_authenticators[] = {
+static const imap_auth_t imap_authenticators[] = {
#ifdef USE_SASL
{ imap_auth_sasl, NULL },
#else
@@ -50,7 +50,7 @@ static imap_auth_t imap_authenticators[] = {
* authentication method if specified, or any. */
int imap_authenticate (IMAP_DATA* idata)
{
- imap_auth_t* authenticator;
+ const imap_auth_t* authenticator;
char* methods;
char* method;
char* delim;
diff --git a/imap/command.c b/imap/command.c
index 18e1a57c..70e7d481 100644
--- a/imap/command.c
+++ b/imap/command.c
@@ -53,7 +53,7 @@ static void cmd_parse_myrights (IMAP_DATA* idata, const char* s);
static void cmd_parse_search (IMAP_DATA* idata, const char* s);
static void cmd_parse_status (IMAP_DATA* idata, char* s);
-static char *Capabilities[] = {
+static const char * const Capabilities[] = {
"IMAP4",
"IMAP4rev1",
"STATUS",
diff --git a/imap/message.c b/imap/message.c
index 3c7a38e8..d318b693 100644
--- a/imap/message.c
+++ b/imap/message.c
@@ -71,7 +71,7 @@ int imap_read_headers (IMAP_DATA* idata, int msgbegin, int msgend)
int rc, mfhrc, oldmsgcount;
int fetchlast = 0;
int maxuid = 0;
- const char *want_headers = "DATE FROM SUBJECT TO CC MESSAGE-ID REFERENCES CONTENT-TYPE CONTENT-DESCRIPTION IN-REPLY-TO REPLY-TO LINES LIST-POST X-LABEL";
+ static const char * const want_headers = "DATE FROM SUBJECT TO CC MESSAGE-ID REFERENCES CONTENT-TYPE CONTENT-DESCRIPTION IN-REPLY-TO REPLY-TO LINES LIST-POST X-LABEL";
progress_t progress;
int retval = -1;
diff --git a/imap/utf7.c b/imap/utf7.c
index cf2ecb4e..a433971c 100644
--- a/imap/utf7.c
+++ b/imap/utf7.c
@@ -24,7 +24,7 @@
#include "charset.h"
#include "imap_private.h"
-static int Index_64[128] = {
+static const int Index_64[128] = {
-1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
-1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
-1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,62, 63,-1,-1,-1,
@@ -35,7 +35,7 @@ static int Index_64[128] = {
41,42,43,44, 45,46,47,48, 49,50,51,-1, -1,-1,-1,-1
};
-static char B64Chars[64] = {
+static const char B64Chars[64] = {
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd',
'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
diff --git a/imap/util.c b/imap/util.c
index b38268e2..f7e0ef5a 100644
--- a/imap/util.c
+++ b/imap/util.c
@@ -612,7 +612,8 @@ void imap_qualify_path (char *dest, size_t len, IMAP_MBOX *mx, char* path)
* surround string with quotes, escape " and \ with \ */
void imap_quote_string (char *dest, size_t dlen, const char *src)
{
- char quote[] = "\"\\", *pt;
+ static const char quote[] = "\"\\";
+ char *pt;
const char *s;
pt = dest;
diff --git a/init.c b/init.c
index 7773a920..efdba2db 100644
--- a/init.c
+++ b/init.c
@@ -1691,7 +1691,8 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err)
{
int query, unset, inv, reset, r = 0;
int idx = -1;
- char *p, scratch[_POSIX_PATH_MAX];
+ const char *p;
+ char scratch[_POSIX_PATH_MAX];
char* myvar;
while (MoreArgs (s))
@@ -2113,7 +2114,7 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err)
{
if (query)
{
- char *vals[] = { "no", "yes", "ask-no", "ask-yes" };
+ static const char * const vals[] = { "no", "yes", "ask-no", "ask-yes" };
snprintf (err->data, err->dsize, "%s=%s", MuttVars[idx].option,
vals [ quadoption (MuttVars[idx].data) ]);
@@ -2481,7 +2482,7 @@ int mutt_command_complete (char *buffer, size_t len, int pos, int numtabs)
|| !mutt_strncmp (buffer, "reset", 5)
|| !mutt_strncmp (buffer, "toggle", 6))
{ /* complete variables */
- char *prefixes[] = { "no", "inv", "?", "&", 0 };
+ static const char * const prefixes[] = { "no", "inv", "?", "&", 0 };
pt++;
/* loop through all the possible prefixes (no, inv, ...) */
@@ -2533,7 +2534,7 @@ int mutt_command_complete (char *buffer, size_t len, int pos, int numtabs)
}
else if (!mutt_strncmp (buffer, "exec", 4))
{
- struct binding_t *menu = km_get_table (CurrentMenu);
+ const struct binding_t *menu = km_get_table (CurrentMenu);
if (!menu && CurrentMenu != MENU_PAGER)
menu = OpGeneric;
@@ -2632,7 +2633,7 @@ int mutt_var_value_complete (char *buffer, size_t len, int pos)
static int var_to_string (int idx, char* val, size_t len)
{
char tmp[LONG_STRING];
- char *vals[] = { "no", "yes", "ask-no", "ask-yes" };
+ static const char * const vals[] = { "no", "yes", "ask-no", "ask-yes" };
tmp[0] = '\0';
@@ -2663,7 +2664,7 @@ static int var_to_string (int idx, char* val, size_t len)
else if (DTYPE (MuttVars[idx].type) == DT_SORT)
{
const struct mapping_t *map;
- char *p;
+ const char *p;
switch (MuttVars[idx].type & DT_SUBTYPE_MASK)
{
@@ -2789,7 +2790,7 @@ int mutt_dump_variables (void)
return 0;
}
-char *mutt_getnamebyvalue (int val, const struct mapping_t *map)
+const char *mutt_getnamebyvalue (int val, const struct mapping_t *map)
{
int i;
@@ -3150,7 +3151,7 @@ void mutt_init (int skip_sys_rc, LIST *commands)
int mutt_get_hook_type (const char *name)
{
- struct command_t *c;
+ const struct command_t *c;
for (c = Commands ; c->name ; c++)
if (c->func == mutt_parse_hook && ascii_strcasecmp (c->name, name) == 0)
diff --git a/init.h b/init.h
index 09dfbf28..360886a1 100644
--- a/init.h
+++ b/init.h
@@ -3488,7 +3488,7 @@ struct command_t
unsigned long data;
};
-struct command_t Commands[] = {
+const struct command_t Commands[] = {
{ "alternates", parse_alternates, 0 },
{ "unalternates", parse_unalternates, 0 },
#ifdef USE_SOCKET
diff --git a/keymap.c b/keymap.c
index d82310a7..56ec05d3 100644
--- a/keymap.c
+++ b/keymap.c
@@ -36,7 +36,7 @@
#include "functions.h"
-struct mapping_t Menus[] = {
+const struct mapping_t Menus[] = {
{ "alias", MENU_ALIAS },
{ "attach", MENU_ATTACH },
{ "browser", MENU_FOLDER },
@@ -298,7 +298,7 @@ void km_bindkey (char *s, int menu, int op)
km_bind (s, menu, op, NULL, NULL);
}
-static int get_op (struct binding_t *bindings, const char *start, size_t len)
+static int get_op (const struct binding_t *bindings, const char *start, size_t len)
{
int i;
@@ -312,7 +312,7 @@ static int get_op (struct binding_t *bindings, const char *start, size_t len)
return OP_NULL;
}
-static char *get_func (struct binding_t *bindings, int op)
+static char *get_func (const struct binding_t *bindings, int op)
{
int i;
@@ -366,7 +366,7 @@ static void push_string (char *s)
* skip the '<' and the '>' when comparing */
for (i = 0; Menus[i].name; i++)
{
- struct binding_t *binding = km_get_table (Menus[i].value);
+ const struct binding_t *binding = km_get_table (Menus[i].value);
if (binding)
{
op = get_op (binding, pp + 1, l - 2);
@@ -465,7 +465,7 @@ int km_dokey (int menu)
if (tmp.op)
{
char *func = NULL;
- struct binding_t *bindings;
+ const struct binding_t *bindings;
/* is this a valid op for this menu? */
if ((bindings = km_get_table (menu)) &&
@@ -540,7 +540,7 @@ int km_dokey (int menu)
/* not reached */
}
-static void create_bindings (struct binding_t *map, int menu)
+static void create_bindings (const struct binding_t *map, int menu)
{
int i;
@@ -549,10 +549,10 @@ static void create_bindings (struct binding_t *map, int menu)
km_bindkey (map[i].seq, menu, map[i].op);
}
-char *km_keyname (int c)
+static const char *km_keyname (int c)
{
static char buf[10];
- char *p;
+ const char *p;
if ((p = mutt_getnamebyvalue (c, KeyNames)))
return p;
@@ -911,7 +911,7 @@ error:
}
static int
-try_bind (char *key, int menu, char *func, struct binding_t *bindings)
+try_bind (char *key, int menu, char *func, const struct binding_t *bindings)
{
int i;
@@ -924,7 +924,7 @@ try_bind (char *key, int menu, char *func, struct binding_t *bindings)
return (-1);
}
-struct binding_t *km_get_table (int menu)
+const struct binding_t *km_get_table (int menu)
{
switch (menu)
{
@@ -971,7 +971,7 @@ struct binding_t *km_get_table (int menu)
/* bind menu-name '<key_sequence>' function-name */
int mutt_parse_bind (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
{
- struct binding_t *bindings = NULL;
+ const struct binding_t *bindings = NULL;
char *key;
int menu[sizeof(Menus)/sizeof(struct mapping_t)-1], r = 0, nummenus, i;
@@ -1072,7 +1072,7 @@ int mutt_parse_exec (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
{
int ops[128];
int nops = 0;
- struct binding_t *bindings = NULL;
+ const struct binding_t *bindings = NULL;
char *function;
if (!MoreArgs (s))
diff --git a/keymap.h b/keymap.h
index 20212fd5..e5c85dea 100644
--- a/keymap.h
+++ b/keymap.h
@@ -45,7 +45,6 @@ struct keymap_t
keycode_t *keys; /* key sequence */
};
-char *km_keyname (int);
int km_expand_key (char *, size_t, struct keymap_t *);
struct keymap_t *km_find_func (int, int);
void km_init (void);
@@ -89,7 +88,7 @@ extern struct keymap_t *Keymaps[];
/* dokey() records the last real key pressed */
extern int LastKey;
-extern struct mapping_t Menus[];
+extern const struct mapping_t Menus[];
struct binding_t
{
@@ -98,25 +97,25 @@ struct binding_t
char *seq; /* default key binding */
};
-struct binding_t *km_get_table (int menu);
+const struct bindin