diff options
author | Dan Fandrich <dan@coneharvesters.com> | 2011-12-03 11:13:10 -0800 |
---|---|---|
committer | Dan Fandrich <dan@coneharvesters.com> | 2011-12-03 11:13:10 -0800 |
commit | 05df9d0879317816dcee00282eea3a06b0310c3b (patch) | |
tree | a454f493b83516bdcf750e881ab9803dd9f112fa /handler.c | |
parent | 13e87955a6610317dd90b29b116edd5196cbcd56 (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 'handler.c')
-rw-r--r-- | handler.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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[] = { |