X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=include%2Fmalloc.h;h=161ccbd129863bb3cea8cb2c279eca4a1759982e;hb=HEAD;hp=024b18be00ebbd2eeefaa3e3e98cd02d7b292956;hpb=1057b1be75386e3513dca392d8258e01e5cccc01;p=platform%2Fkernel%2Fu-boot.git diff --git a/include/malloc.h b/include/malloc.h index 024b18b..161ccbd 100644 --- a/include/malloc.h +++ b/include/malloc.h @@ -1,12 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* - A version of malloc/free/realloc written by Doug Lea and released to the - public domain. Send questions/comments/complaints/performance data - to dl@cs.oswego.edu + This code is based on a version of malloc/free/realloc written by Doug Lea and + released to the public domain. Send questions/comments/complaints/performance + data to dl@cs.oswego.edu * VERSION 2.6.6 Sun Mar 5 19:10:03 2000 Doug Lea (dl at gee) Note: There may be an updated version of this malloc obtainable at - ftp://g.oswego.edu/pub/misc/malloc.c + http://g.oswego.edu/pub/misc/malloc.c Check before installing! * Why use this malloc? @@ -882,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