gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r25941 - in libmicrohttpd: . src/daemon


From: gnunet
Subject: [GNUnet-SVN] r25941 - in libmicrohttpd: . src/daemon
Date: Wed, 30 Jan 2013 13:26:27 +0100

Author: grothoff
Date: 2013-01-30 13:26:27 +0100 (Wed, 30 Jan 2013)
New Revision: 25941

Modified:
   libmicrohttpd/ChangeLog
   libmicrohttpd/src/daemon/reason_phrase.c
Log:
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







Modified: libmicrohttpd/ChangeLog
===================================================================
--- libmicrohttpd/ChangeLog     2013-01-30 11:10:16 UTC (rev 25940)
+++ libmicrohttpd/ChangeLog     2013-01-30 12:26:27 UTC (rev 25941)
@@ -1,3 +1,7 @@
+Wed Jan 30 13:09:30 CET 2013
+       Adding more 'const' to allow keeping of reason phrases in ROM.
+       (see mailinglist). -CG/MV
+
 Tue Jan 29 21:27:56 CET 2013
        Make code work with PlibC 0.1.7 (which removed plibc_init_utf8).
        Only relevant for W32. Fixes #2734. -CG

Modified: libmicrohttpd/src/daemon/reason_phrase.c
===================================================================
--- libmicrohttpd/src/daemon/reason_phrase.c    2013-01-30 11:10:16 UTC (rev 
25940)
+++ libmicrohttpd/src/daemon/reason_phrase.c    2013-01-30 12:26:27 UTC (rev 
25941)
@@ -33,13 +33,13 @@
 
 static const char *invalid_hundred[] = { NULL };
 
-static const char *one_hundred[] = {
+static const char *const one_hundred[] = {
   "Continue",
   "Switching Protocols",
   "Processing"
 };
 
-static const char *two_hundred[] = {
+static const char *const two_hundred[] = {
   "OK",
   "Created",
   "Accepted",
@@ -50,7 +50,7 @@
   "Multi Status"
 };
 
-static const char *three_hundred[] = {
+static const char *const three_hundred[] = {
   "Multiple Choices",
   "Moved Permanently",
   "Moved Temporarily",
@@ -61,7 +61,7 @@
   "Temporary Redirect"
 };
 
-static const char *four_hundred[] = {
+static const char *const four_hundred[] = {
   "Bad Request",
   "Unauthorized",
   "Payment Required",
@@ -116,7 +116,7 @@
   "Unavailable For Legal Reasons"
 };
 
-static const char *five_hundred[] = {
+static const char *const five_hundred[] = {
   "Internal Server Error",
   "Not Implemented",
   "Bad Gateway",
@@ -134,7 +134,7 @@
 struct MHD_Reason_Block
 {
   unsigned int max;
-  const char **data;
+  const char *const*data;
 };
 
 #define BLOCK(m) { (sizeof(m) / sizeof(char*)), m }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]