mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-14 06:42:58 +08:00
feat(stdlib): add lv_calloc function (#6743)
Signed-off-by: zhangjipeng <zhangjipeng@xiaomi.com> Signed-off-by: Zhang Ji Peng <onecoolx@gmail.com> Co-authored-by: zhangjipeng <zhangjipeng@xiaomi.com>
This commit is contained in:
parent
a285435aed
commit
d0f74979f2
@ -116,6 +116,17 @@ void * lv_malloc_zeroed(size_t size)
|
||||
return alloc;
|
||||
}
|
||||
|
||||
void * lv_calloc(size_t num, size_t size)
|
||||
{
|
||||
LV_TRACE_MEM("allocating number of %zu each %zu bytes", num, size);
|
||||
return lv_malloc_zeroed(num * size);
|
||||
}
|
||||
|
||||
void * lv_zalloc(size_t size)
|
||||
{
|
||||
return lv_malloc_zeroed(size);
|
||||
}
|
||||
|
||||
void lv_free(void * data)
|
||||
{
|
||||
LV_TRACE_MEM("freeing %p", data);
|
||||
|
@ -68,6 +68,21 @@ void lv_mem_remove_pool(lv_mem_pool_t pool);
|
||||
*/
|
||||
void * lv_malloc(size_t size);
|
||||
|
||||
/**
|
||||
* Allocate a block of zeroed memory dynamically
|
||||
* @param num requested number of element to be allocated.
|
||||
* @param size requested size of each element in bytes.
|
||||
* @return pointer to allocated zeroed memory, or NULL on failure
|
||||
*/
|
||||
void * lv_calloc(size_t num, size_t size);
|
||||
|
||||
/**
|
||||
* Allocate zeroed memory dynamically
|
||||
* @param size requested size in bytes
|
||||
* @return pointer to allocated zeroed memory, or NULL on failure
|
||||
*/
|
||||
void * lv_zalloc(size_t size);
|
||||
|
||||
/**
|
||||
* Allocate zeroed memory dynamically
|
||||
* @param size requested size in bytes
|
||||
|
Loading…
x
Reference in New Issue
Block a user