[examples] make built-in otPlatCalloc and otPlatFree definitions weak (#8188)

This will allow platforms to define their own `otPlatCalloc` and
`otPlatFree` functions which may not map directly to `calloc()`
and `free()`
This commit is contained in:
Mason Tran
2022-09-21 11:11:37 -07:00
committed by GitHub
parent 5a627ba0fd
commit 32d7405174
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -50,12 +50,12 @@
extern void otAppCliInit(otInstance *aInstance);
#if OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE
void *otPlatCAlloc(size_t aNum, size_t aSize)
OT_TOOL_WEAK void *otPlatCAlloc(size_t aNum, size_t aSize)
{
return calloc(aNum, aSize);
}
void otPlatFree(void *aPtr)
OT_TOOL_WEAK void otPlatFree(void *aPtr)
{
free(aPtr);
}
+2 -2
View File
@@ -46,12 +46,12 @@
extern void otAppNcpInit(otInstance *aInstance);
#if OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE
void *otPlatCAlloc(size_t aNum, size_t aSize)
OT_TOOL_WEAK void *otPlatCAlloc(size_t aNum, size_t aSize)
{
return calloc(aNum, aSize);
}
void otPlatFree(void *aPtr)
OT_TOOL_WEAK void otPlatFree(void *aPtr)
{
free(aPtr);
}