Commit 05df9d08 authored by Dan Fandrich's avatar Dan Fandrich

Declare many structures const (closes #3552)

Many structs used in mutt are actually constant but are defined
without the 'const' keyword. This can slow initialization (slightly)
in some environments due to extra copying and increases the amount of
writable RAM required at run-time, which can be significant on non-MMU
systems. Using const can also increase the opportunities for compiler
optimization.

The attached patch marks many such structures as const. On my test x86
build, this reduces the size of .data by over 50%.
parent 13e87955
......@@ -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 },
......
......@@ -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 },
......
......@@ -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[] =
{
......
......@@ -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)
......
......@@ -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 },
......
......@@ -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;
......
......@@ -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);
......
......@@ -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 },
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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" },
......
......@@ -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
......
......@@ -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[] = {
......
......@@ -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));
......
......@@ -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;
......
......@@ -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",
......
......@@ -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;
......
......@@ -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',
......
......@@ -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;
......
......@@ -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)
......
......@@ -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
......
......@@ -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))
......
......@@ -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 binding_t *km_get_table (int menu);
extern struct binding_t OpGeneric[];
extern struct binding_t OpPost[];
extern struct binding_t OpMain[];
extern struct binding_t OpAttach[];
extern struct binding_t OpPager[];
extern struct binding_t OpCompose[];
extern struct binding_t OpBrowser[];
extern struct binding_t OpEditor[];
extern struct binding_t OpQuery[];
extern struct binding_t OpAlias[];
extern const struct binding_t OpGeneric[];
extern const struct binding_t OpPost[];
extern const struct binding_t OpMain[];
extern const struct binding_t OpAttach[];
extern const struct binding_t OpPager[];
extern const struct binding_t OpCompose[];
extern const struct binding_t OpBrowser[];
extern const struct binding_t OpEditor[];
extern const struct binding_t OpQuery[];
extern const struct binding_t OpAlias[];
extern struct binding_t OpPgp[];
extern const struct binding_t OpPgp[];
extern struct binding_t OpSmime[];
extern const struct binding_t OpSmime[];
#ifdef MIXMASTER
extern struct binding_t OpMix[];
extern const struct binding_t OpMix[];
#endif
#include "keymap_defs.h"
......
......@@ -53,7 +53,7 @@
#include "lib.h"
static struct sysexits
static const struct sysexits
{
int v;
const char *str;
......@@ -696,7 +696,7 @@ FILE *safe_fopen (const char *path, const char *mode)
return (fopen (path, mode));
}
static char safe_chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+@{}._-:%/";
static const char safe_chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+@{}._-:%/";
void mutt_sanitize_filename (char *f, short slash)
{
......@@ -711,7 +711,7 @@ void mutt_sanitize_filename (char *f, short slash)
/* these characters must be escaped in regular expressions */
static char rx_special_chars[] = "^.[$()|*+?{\\";
static const char rx_special_chars[] = "^.[$()|*+?{\\";
int mutt_rx_sanitize_string (char *dest, size_t destlen, const char *src)
{
......
......@@ -21,12 +21,12 @@
struct mapping_t
{
char *name;
const char *name;
int value;
};
char *mutt_getnamebyvalue (int, const struct mapping_t *);
char *mutt_compile_help (char *, size_t, int, struct mapping_t *);
const char *mutt_getnamebyvalue (int, const struct mapping_t *);
char *mutt_compile_help (char *, size_t, int, const struct mapping_t *);
int mutt_getvaluebyname (const char *, const struct mapping_t *);
......
......@@ -55,9 +55,9 @@ enum
/* MIME encoding/decoding global vars */
#ifndef _SENDLIB_C
extern int Index_hex[];
extern int Index_64[];
extern char B64Chars[];
extern const int Index_hex[];
extern const int Index_64[];
extern const char B64Chars[];
#endif
#define hexval(c) Index_hex[(unsigned int)(c)]
......
......@@ -911,7 +911,7 @@ static int ssl_check_certificate (CONNECTION *conn, sslsockdata *data)
static int interactive_check_cert (X509 *cert, int idx, int len)
{