1
0
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:
Zhang Ji Peng 2024-08-29 20:47:09 +08:00 committed by GitHub
parent a285435aed
commit d0f74979f2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 26 additions and 0 deletions

View File

@ -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);

View File

@ -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