Added mem_calloc().

This commit is contained in:
marcbou 2007-08-16 18:37:15 +00:00
parent 0b4402ebc8
commit 95cbf95c50
2 changed files with 15 additions and 0 deletions

View File

@ -500,4 +500,15 @@ mem_malloc(mem_size_t size)
}
#endif /* MEM_USE_POOLS */
void *mem_calloc(size_t count, size_t size)
{
void *p;
p = mem_malloc(count * size);
if(p) {
memset(p, 0, count * size);
}
return p;
}
#endif /* !MEM_LIBC_MALLOC */

View File

@ -62,6 +62,9 @@ typedef u16_t mem_size_t;
#ifndef mem_malloc
#define mem_malloc(x) malloc(x)
#endif
#ifndef mem_calloc
#define mem_calloc(x, y) calloc(x, y)
#endif
#ifndef mem_realloc
#define mem_realloc(x, size) realloc(x,size)
#endif
@ -81,6 +84,7 @@ void *mem_realloc(void *mem, mem_size_t size);
#endif /* MEM_USE_POOLS */
void *mem_malloc(mem_size_t size);
void mem_free(void *mem);
void *mem_calloc(size_t count, size_t size);
#endif /* MEM_LIBC_MALLOC */
#ifndef LWIP_MEM_ALIGN_SIZE