Added MEM_LIBC_MALLOC option as workaround for failing mem_malloc().

This commit is contained in:
christiaans 2006-12-01 15:38:56 +00:00
parent 36e6c26545
commit a91374a916
3 changed files with 20 additions and 5 deletions

View File

@ -27,12 +27,16 @@ HISTORY
++ New features:
2006-12-01 Christiaan Simons
* mem.h, opt.h: Added MEM_LIBC_MALLOC option.
Note this is a workaround. Currently I have no other options left.
2006-10-26 Christiaan Simons (accepted patch by Jonathan Larmour)
* src/core/ipv4/ip_frag.c: rename MAX_MTU to IP_FRAG_MAX_MTU and move define
* ipv4/ip_frag.c: rename MAX_MTU to IP_FRAG_MAX_MTU and move define
to include/lwip/opt.h.
* include/ipv4/lwip/ip_frag.h: Remove unused IP_REASS_INTERVAL.
* ipv4/lwip/ip_frag.h: Remove unused IP_REASS_INTERVAL.
Move IP_REASS_MAXAGE and IP_REASS_BUFSIZE to include/lwip/opt.h.
* include/lwip/opt.h: Add above new options.
* opt.h: Add above new options.
2006-08-18 Christiaan Simons
* tcp_{in,out}.c: added SNMP counters.

View File

@ -43,12 +43,19 @@ typedef u16_t mem_size_t;
#define MEM_SIZE_F U16_F
#endif /* MEM_SIZE > 64000 */
#if MEM_LIBC_MALLOC
/* aliases for C library malloc() */
#define mem_init()
#define mem_free(x) free(x)
#define mem_malloc(x) malloc(x)
#define mem_realloc(x, size) realloc(x,size)
#else
/* lwIP alternative malloc */
void mem_init(void);
void *mem_malloc(mem_size_t size);
void mem_free(void *mem);
void *mem_realloc(void *mem, mem_size_t size);
#endif
#ifndef MEM_ALIGN_SIZE
#define MEM_ALIGN_SIZE(size) (((size) + MEM_ALIGNMENT - 1) & ~(MEM_ALIGNMENT-1))

View File

@ -53,6 +53,10 @@
#define NO_SYS 0
#endif
/* ---------- Memory options ---------- */
#ifndef MEM_LIBC_MALLOC
#define MEM_LIBC_MALLOC 0
#endif
/* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
byte alignment -> define MEM_ALIGNMENT to 2. */