X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=include%2Fmalloc.h;h=161ccbd129863bb3cea8cb2c279eca4a1759982e;hb=HEAD;hp=1fbaf3755c7aa2b1f4bd1b3804ae06d3d3ff047a;hpb=6fc0a2f76bc285dc4bc80f55452311385e6c3d57;p=platform%2Fkernel%2Fu-boot.git diff --git a/include/malloc.h b/include/malloc.h index 1fbaf37..161ccbd 100644 --- a/include/malloc.h +++ b/include/malloc.h @@ -883,11 +883,27 @@ extern Void_t* sbrk(); void malloc_simple_info(void); +/** + * malloc_enable_testing() - Put malloc() into test mode + * + * This only works if UNIT_TESTING is enabled + * + * @max_allocs: return -ENOMEM after max_allocs calls to malloc() + */ +void malloc_enable_testing(int max_allocs); + +/** malloc_disable_testing() - Put malloc() into normal mode */ +void malloc_disable_testing(void); + #if CONFIG_IS_ENABLED(SYS_MALLOC_SIMPLE) #define malloc malloc_simple #define realloc realloc_simple #define memalign memalign_simple +#if IS_ENABLED(CONFIG_VALGRIND) +#define free free_simple +#else static inline void free(void *ptr) {} +#endif void *calloc(size_t nmemb, size_t size); void *realloc_simple(void *ptr, size_t size); #else