Reduce default memory allocation for strings

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2034 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2009-09-11 15:44:47 +00:00
parent 3ae6193334
commit 1b8d8c71da
2 changed files with 7 additions and 3 deletions

View File

@ -144,8 +144,12 @@
# define CONFIG_THTTPD_IOBUFFERSIZE 256 # define CONFIG_THTTPD_IOBUFFERSIZE 256
# endif # endif
# ifndef CONFIG_THTTPD_MINSTRSIZE
# define CONFIG_THTTPD_MINSTRSIZE 64
# endif
# ifndef CONFIG_THTTPD_REALLOCINCR # ifndef CONFIG_THTTPD_REALLOCINCR
# define CONFIG_THTTPD_REALLOCINCR 128 # define CONFIG_THTTPD_REALLOCINCR 64
# endif # endif
# ifndef CONFIG_THTTPD_MAXREALLOC # ifndef CONFIG_THTTPD_MAXREALLOC
@ -153,7 +157,7 @@
# endif # endif
# if CONFIG_THTTPD_IOBUFFERSIZE > 65535 # if CONFIG_THTTPD_IOBUFFERSIZE > 65535
# error "Can't use uint16 for buffer" # error "Can't use uint16 for buffer size"
# endif # endif
/* A list of index filenames to check. The files are searched for in this order. */ /* A list of index filenames to check. The files are searched for in this order. */

View File

@ -139,7 +139,7 @@ void httpd_realloc_str(char **pstr, size_t *maxsize, size_t size)
size_t oldsize; size_t oldsize;
if (*maxsize == 0) if (*maxsize == 0)
{ {
*maxsize = MAX(CONFIG_THTTPD_IOBUFFERSIZE, size + CONFIG_THTTPD_REALLOCINCR); *maxsize = MAX(CONFIG_THTTPD_MINSTRSIZE, size + CONFIG_THTTPD_REALLOCINCR);
*pstr = NEW(char, *maxsize + 1); *pstr = NEW(char, *maxsize + 1);
} }
else if (size > *maxsize) else if (size > *maxsize)