lvgl: provide lvgl_realloc()
In order to support lvgl v8, we need to provide a realloc() implementation in our custom sys_heap allocator. This uses sys_heap_realloc() internally and exposes traditional realloc() semantics. Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@huawei.com>
This commit is contained in:
parent
b7dbe1a51e
commit
1e80d5a954
|
@ -30,6 +30,18 @@ void *lvgl_malloc(size_t size)
|
|||
return ret;
|
||||
}
|
||||
|
||||
void *lvgl_realloc(void *ptr, size_t size)
|
||||
{
|
||||
k_spinlock_key_t key;
|
||||
void *ret;
|
||||
|
||||
key = k_spin_lock(&lvgl_heap_lock);
|
||||
ret = sys_heap_realloc(&lvgl_heap, ptr, size);
|
||||
k_spin_unlock(&lvgl_heap_lock, key);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void lvgl_free(void *ptr)
|
||||
{
|
||||
k_spinlock_key_t key;
|
||||
|
|
|
@ -15,6 +15,8 @@ extern "C" {
|
|||
|
||||
void *lvgl_malloc(size_t size);
|
||||
|
||||
void *lvgl_realloc(void *ptr, size_t size);
|
||||
|
||||
void lvgl_free(void *ptr);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
Loading…
Reference in a new issue