mem: Include stdlib.h to fix build warnings when MEM_LIBC_MALLOC is set

Include stdlib.h to fix below build warnings when MEM_LIBC_MALLOC is set:
src/core/mem.c:119:3: warning: implicit declaration of function 'malloc' [-Wimplicit-function-declaration]
   void* ret = mem_clib_malloc(size + MEM_LIBC_STATSHELPER_SIZE);
   ^
src/core/mem.c:96:25: warning: incompatible implicit declaration of built-in function 'malloc'
 #define mem_clib_malloc malloc
                         ^
src/core/mem.c:119:15: note: in expansion of macro 'mem_clib_malloc'
   void* ret = mem_clib_malloc(size + MEM_LIBC_STATSHELPER_SIZE);
               ^
src/core/mem.c: In function 'mem_free':
src/core/mem.c:146:3: warning: implicit declaration of function 'free' [-Wimplicit-function-declaration]
   mem_clib_free(rmem);
   ^
src/core/mem.c:93:23: warning: incompatible implicit declaration of built-in function 'free'
 #define mem_clib_free free
                       ^
src/core/mem.c:146:3: note: in expansion of macro 'mem_clib_free'
   mem_clib_free(rmem);
   ^

Signed-off-by: Axel Lin <axel.lin@ingics.com>
This commit is contained in:
Axel Lin 2016-08-08 14:21:23 +08:00 committed by goldsimon
parent 08378b7d4b
commit e4c01a064e

View File

@ -45,6 +45,7 @@ extern "C" {
#if MEM_LIBC_MALLOC
#include <stdlib.h>
#include <stddef.h> /* for size_t */
typedef size_t mem_size_t;
#define MEM_SIZE_F SZT_F