diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-01-30 12:26:27 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-01-30 12:26:27 +0000 |
commit | ef3bdbd92e107624899300351840bd8f787480c7 (patch) | |
tree | eafafd99b4d7991c0a452484811148e9ecb86081 /src/daemon/reason_phrase.c | |
parent | 49b0e0ce8f929b326b6e926e26dede64f29756d0 (diff) | |
download | libmicrohttpd-ef3bdbd92e107624899300351840bd8f787480c7.tar.gz libmicrohttpd-ef3bdbd92e107624899300351840bd8f787480c7.zip |
Hello,
could be possible to change declarations for arrays of strings in the file reason_phrase.c?
Currently it is static const char * []. This places all strings into .rodata section and pointers to them into LMA of .text and also into .data in VMA.
E.g. for an ARM Cortex M3 (flash + SRAM) compiled with a arm-none-eabi-gcc
static const char *one_hundred[] = {
"Continue",
"Switching Protocols",
"Processing"
};
Strings "Continue", "Switching Protocols", "Processing" are stored in flash. Also an array with pointers to strings is stored in flash. In addition, this array is copied into SRAM (+16 bytes). If you would change it to "static const char * const one_hundred[]" ... it would occupy only flash.
and
struct MHD_Reason_Block
{
......
const char * const * data;
};
I agree, it is not relevant on a PC but on most microcontroller the SRAM is a limiting factor not the rom(flash).
Best
Martin Velek
Diffstat (limited to 'src/daemon/reason_phrase.c')
-rw-r--r-- | src/daemon/reason_phrase.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/daemon/reason_phrase.c b/src/daemon/reason_phrase.c index 6e7f4bcc..843f47a9 100644 --- a/src/daemon/reason_phrase.c +++ b/src/daemon/reason_phrase.c | |||
@@ -33,13 +33,13 @@ | |||
33 | 33 | ||
34 | static const char *invalid_hundred[] = { NULL }; | 34 | static const char *invalid_hundred[] = { NULL }; |
35 | 35 | ||
36 | static const char *one_hundred[] = { | 36 | static const char *const one_hundred[] = { |
37 | "Continue", | 37 | "Continue", |
38 | "Switching Protocols", | 38 | "Switching Protocols", |
39 | "Processing" | 39 | "Processing" |
40 | }; | 40 | }; |
41 | 41 | ||
42 | static const char *two_hundred[] = { | 42 | static const char *const two_hundred[] = { |
43 | "OK", | 43 | "OK", |
44 | "Created", | 44 | "Created", |
45 | "Accepted", | 45 | "Accepted", |
@@ -50,7 +50,7 @@ static const char *two_hundred[] = { | |||
50 | "Multi Status" | 50 | "Multi Status" |
51 | }; | 51 | }; |
52 | 52 | ||
53 | static const char *three_hundred[] = { | 53 | static const char *const three_hundred[] = { |
54 | "Multiple Choices", | 54 | "Multiple Choices", |
55 | "Moved Permanently", | 55 | "Moved Permanently", |
56 | "Moved Temporarily", | 56 | "Moved Temporarily", |
@@ -61,7 +61,7 @@ static const char *three_hundred[] = { | |||
61 | "Temporary Redirect" | 61 | "Temporary Redirect" |
62 | }; | 62 | }; |
63 | 63 | ||
64 | static const char *four_hundred[] = { | 64 | static const char *const four_hundred[] = { |
65 | "Bad Request", | 65 | "Bad Request", |
66 | "Unauthorized", | 66 | "Unauthorized", |
67 | "Payment Required", | 67 | "Payment Required", |
@@ -116,7 +116,7 @@ static const char *four_hundred[] = { | |||
116 | "Unavailable For Legal Reasons" | 116 | "Unavailable For Legal Reasons" |
117 | }; | 117 | }; |
118 | 118 | ||
119 | static const char *five_hundred[] = { | 119 | static const char *const five_hundred[] = { |
120 | "Internal Server Error", | 120 | "Internal Server Error", |
121 | "Not Implemented", | 121 | "Not Implemented", |
122 | "Bad Gateway", | 122 | "Bad Gateway", |
@@ -134,7 +134,7 @@ static const char *five_hundred[] = { | |||
134 | struct MHD_Reason_Block | 134 | struct MHD_Reason_Block |
135 | { | 135 | { |
136 | unsigned int max; | 136 | unsigned int max; |
137 | const char **data; | 137 | const char *const*data; |
138 | }; | 138 | }; |
139 | 139 | ||
140 | #define BLOCK(m) { (sizeof(m) / sizeof(char*)), m } | 140 | #define BLOCK(m) { (sizeof(m) / sizeof(char*)), m } |