mirror of
https://github.com/apache/nuttx.git
synced 2026-08-30 21:53:06 +00:00
mm: Add kmm_malloc_size and mm_malloc_size
make malloc_size implementation align with malloc Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com> Change-Id: I8d7781925f06e58a880437a16569dccbfd2ea035
This commit is contained in:
parent
ddaa3e42b9
commit
75bfa4584c
9 changed files with 118 additions and 25 deletions
|
|
@ -73,6 +73,7 @@ extern "C"
|
|||
|
||||
#define kumm_calloc(n,s) calloc(n,s);
|
||||
#define kumm_malloc(s) malloc(s)
|
||||
#define kumm_malloc_size(p) malloc_size(p)
|
||||
#define kumm_zalloc(s) zalloc(s)
|
||||
#define kumm_realloc(p,s) realloc(p,s)
|
||||
#define kumm_memalign(a,s) memalign(a,s)
|
||||
|
|
@ -92,6 +93,7 @@ extern "C"
|
|||
|
||||
# define kmm_calloc(n,s) calloc(n,s);
|
||||
# define kmm_malloc(s) malloc(s)
|
||||
# define kmm_malloc_size(p) malloc_size(p)
|
||||
# define kmm_zalloc(s) zalloc(s)
|
||||
# define kmm_realloc(p,s) realloc(p,s)
|
||||
# define kmm_memalign(a,s) memalign(a,s)
|
||||
|
|
|
|||
|
|
@ -45,37 +45,41 @@
|
|||
|
||||
/* Domain-specific allocations */
|
||||
|
||||
# define lib_malloc(s) kmm_malloc(s)
|
||||
# define lib_zalloc(s) kmm_zalloc(s)
|
||||
# define lib_realloc(p,s) kmm_realloc(p,s)
|
||||
# define lib_memalign(p,s) kmm_memalign(p,s)
|
||||
# define lib_free(p) kmm_free(p)
|
||||
# define lib_malloc(s) kmm_malloc(s)
|
||||
# define lib_malloc_size(p) kmm_malloc_size(p)
|
||||
# define lib_zalloc(s) kmm_zalloc(s)
|
||||
# define lib_realloc(p,s) kmm_realloc(p,s)
|
||||
# define lib_memalign(p,s) kmm_memalign(p,s)
|
||||
# define lib_free(p) kmm_free(p)
|
||||
|
||||
/* User-accessible allocations */
|
||||
|
||||
# define lib_umalloc(s) kumm_malloc(s)
|
||||
# define lib_uzalloc(s) kumm_zalloc(s)
|
||||
# define lib_urealloc(p,s) kumm_realloc(p,s)
|
||||
# define lib_umemalign(p,s) kumm_memalign(p,s)
|
||||
# define lib_ufree(p) kumm_free(p)
|
||||
# define lib_umalloc(s) kumm_malloc(s)
|
||||
# define lib_umalloc_size(p) kumm_malloc_size(p)
|
||||
# define lib_uzalloc(s) kumm_zalloc(s)
|
||||
# define lib_urealloc(p,s) kumm_realloc(p,s)
|
||||
# define lib_umemalign(p,s) kumm_memalign(p,s)
|
||||
# define lib_ufree(p) kumm_free(p)
|
||||
|
||||
#else
|
||||
|
||||
/* Domain-specific allocations */
|
||||
|
||||
# define lib_malloc(s) malloc(s)
|
||||
# define lib_zalloc(s) zalloc(s)
|
||||
# define lib_realloc(p,s) realloc(p,s)
|
||||
# define lib_memalign(p,s) memalign(p,s)
|
||||
# define lib_free(p) free(p)
|
||||
# define lib_malloc(s) malloc(s)
|
||||
# define lib_malloc_size(p) malloc_size(p)
|
||||
# define lib_zalloc(s) zalloc(s)
|
||||
# define lib_realloc(p,s) realloc(p,s)
|
||||
# define lib_memalign(p,s) memalign(p,s)
|
||||
# define lib_free(p) free(p)
|
||||
|
||||
/* User-accessible allocations */
|
||||
|
||||
# define lib_umalloc(s) malloc(s)
|
||||
# define lib_uzalloc(s) zalloc(s)
|
||||
# define lib_urealloc(p,s) realloc(p,s)
|
||||
# define lib_umemalign(p,s) memalign(p,s)
|
||||
# define lib_ufree(p) free(p)
|
||||
# define lib_umalloc(s) malloc(s)
|
||||
# define lib_umalloc_size(p) malloc_size(p)
|
||||
# define lib_uzalloc(s) zalloc(s)
|
||||
# define lib_urealloc(p,s) realloc(p,s)
|
||||
# define lib_umemalign(p,s) memalign(p,s)
|
||||
# define lib_ufree(p) free(p)
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -193,6 +193,16 @@ FAR void *mm_malloc(FAR struct mm_heap_s *heap, size_t size);
|
|||
FAR void *kmm_malloc(size_t size);
|
||||
#endif
|
||||
|
||||
/* Functions contained in mm_malloc_size.c **********************************/
|
||||
|
||||
size_t mm_malloc_size(FAR void *mem);
|
||||
|
||||
/* Functions contained in kmm_malloc_size.c *********************************/
|
||||
|
||||
#ifdef CONFIG_MM_KERNEL_HEAP
|
||||
size_t kmm_malloc_size(FAR void *mem);
|
||||
#endif
|
||||
|
||||
/* Functions contained in mm_free.c *****************************************/
|
||||
|
||||
void mm_free(FAR struct mm_heap_s *heap, FAR void *mem);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue