If MEM_LIBC_MALLOC==1, allow the defines (e.g. mem_malloc() -> malloc()) to be overriden in case the C-library malloc implementation is not protected against concurrent access.

This commit is contained in:
goldsimon 2007-05-08 11:00:49 +00:00
parent 4dbf1dcad4
commit 1571881f7a
2 changed files with 16 additions and 2 deletions

View File

@ -23,6 +23,11 @@ HISTORY
++ New features:
2007-05-08 Simon Goldschmidt
* mem.h: If MEM_LIBC_MALLOC==1, allow the defines (e.g. mem_malloc() -> malloc())
to be overriden in case the C-library malloc implementation is not protected
against concurrent access.
2007-05-04 Simon Goldschmidt (Atte Kojo)
* etharp.c: Introduced fast one-entry-cache to speed up ARP lookup when sending
multiple packets to the same host.

View File

@ -46,16 +46,25 @@ typedef u16_t mem_size_t;
#if MEM_LIBC_MALLOC
/* aliases for C library malloc() */
#define mem_init()
/* in case C library malloc() needs extra protection,
* allow these defines to be overridden.
*/
#ifndef mem_free
#define mem_free(x) free(x)
#endif
#ifndef mem_malloc
#define mem_malloc(x) malloc(x)
#endif
#ifndef mem_realloc
#define mem_realloc(x, size) realloc(x,size)
#else
#endif
#else /* MEM_LIBC_MALLOC */
/* 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
#endif /* MEM_LIBC_MALLOC */
#ifndef MEM_ALIGN_SIZE
#define MEM_ALIGN_SIZE(size) (((size) + MEM_ALIGNMENT - 1) & ~(MEM_ALIGNMENT-1))