[heap] fix external heap configuration (#6123)

The Instance::HeapCAlloc() method can not be used in constructors when
EXTERNAL_HEAP is enabled but works well when internal heap is
used. This is because the external heap methods are set by public
otHeapSetCAllocFree API after the OT instance is constructed.

This commit fixes this issue by having Instance::HeapCAlloc() using
otPlatCAlloc when EXTERNAL_HEAP is enabled. It also fixes build issues
when MULTIPLE_INSTANCE and EXTERNAL_HEAP are used together.
This commit is contained in:
kangping
2021-02-05 10:15:13 -08:00
committed by GitHub
parent 099dfa2731
commit 31746000e8
22 changed files with 137 additions and 177 deletions
+1 -1
View File
@@ -94,7 +94,7 @@ bool sDiagMode = false;
extern "C" {
#if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE
#if OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE
void *otPlatCAlloc(size_t aNum, size_t aSize)
{
return calloc(aNum, aSize);