summaryrefslogtreecommitdiffstats
path: root/mapping.h
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2011-12-03 11:13:10 -0800
committerDan Fandrich <dan@coneharvesters.com>2011-12-03 11:13:10 -0800
commit05df9d0879317816dcee00282eea3a06b0310c3b (patch)
treea454f493b83516bdcf750e881ab9803dd9f112fa /mapping.h
parent13e87955a6610317dd90b29b116edd5196cbcd56 (diff)
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%.
Diffstat (limited to 'mapping.h')
-rw-r--r--mapping.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/mapping.h b/mapping.h
index 6f400575..760c33a8 100644
--- a/mapping.h
+++ b/mapping.h
@@ -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 *);