1 #include "private-libwebsockets.h"
3 #if defined(LWS_PLAT_OPTEE)
5 #define TEE_USER_MEM_HINT_NO_FILL_ZERO 0x80000000
7 void *__attribute__((weak))
8 TEE_Malloc(uint32_t size, uint32_t hint)
12 void *__attribute__((weak))
13 TEE_Realloc(void *buffer, uint32_t newSize)
17 void __attribute__((weak))
18 TEE_Free(void *buffer)
22 void *lws_realloc(void *ptr, size_t size)
24 return TEE_Realloc(ptr, size);
27 void *lws_malloc(size_t size)
29 return TEE_Malloc(size, TEE_USER_MEM_HINT_NO_FILL_ZERO);
32 void lws_free(void *p)
37 void *lws_zalloc(size_t size)
39 void *ptr = TEE_Malloc(size, TEE_USER_MEM_HINT_NO_FILL_ZERO);
45 void lws_set_allocator(void *(*cb)(void *ptr, size_t size))
51 static void *_realloc(void *ptr, size_t size)
54 #if defined(LWS_PLAT_OPTEE)
55 return (void *)TEE_Realloc(ptr, size);
57 return (void *)realloc(ptr, size);
64 void *(*_lws_realloc)(void *ptr, size_t size) = _realloc;
66 void *lws_realloc(void *ptr, size_t size)
68 return _lws_realloc(ptr, size);
71 void *lws_zalloc(size_t size)
73 void *ptr = _lws_realloc(NULL, size);
79 void lws_set_allocator(void *(*cb)(void *ptr, size_t size))