aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/reason_phrase.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-01-30 12:26:27 +0000
committerChristian Grothoff <christian@grothoff.org>2013-01-30 12:26:27 +0000
commitef3bdbd92e107624899300351840bd8f787480c7 (patch)
treeeafafd99b4d7991c0a452484811148e9ecb86081 /src/daemon/reason_phrase.c
parent49b0e0ce8f929b326b6e926e26dede64f29756d0 (diff)
downloadlibmicrohttpd-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.c12
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
34static const char *invalid_hundred[] = { NULL }; 34static const char *invalid_hundred[] = { NULL };
35 35
36static const char *one_hundred[] = { 36static const char *const one_hundred[] = {
37 "Continue", 37 "Continue",
38 "Switching Protocols", 38 "Switching Protocols",
39 "Processing" 39 "Processing"
40}; 40};
41 41
42static const char *two_hundred[] = { 42static 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
53static const char *three_hundred[] = { 53static 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
64static const char *four_hundred[] = { 64static 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
119static const char *five_hundred[] = { 119static 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[] = {
134struct MHD_Reason_Block 134struct 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 }