mirror of
https://github.com/espressif/openthread.git
synced 2026-08-01 16:47:47 +00:00
Enable mbedTLS dynamic memory allocation in user mode on Windows (#1373)
* change user mode openthread to enable dynamic memory allocation in mbedtls * complete merge by adding OPENTHREAD_MULTIPLE_INSTANCE to last file * remove some extraneous changes that got pulled in accidentally * fix spacing * fix crash in existing tests due to this change * fix x86 build
This commit is contained in:
committed by
Jonathan Hui
parent
1587835134
commit
f3817e76cf
@@ -192,7 +192,23 @@ void TestMessageQueueOtApis(void)
|
||||
ThreadError error;
|
||||
otMessage message;
|
||||
|
||||
#ifdef OPENTHREAD_MULTIPLE_INSTANCE
|
||||
size_t otInstanceBufferLength = 0;
|
||||
uint8_t *otInstanceBuffer = NULL;
|
||||
|
||||
// Call to query the buffer size
|
||||
(void)otInstanceInit(NULL, &otInstanceBufferLength);
|
||||
|
||||
// Call to allocate the buffer
|
||||
otInstanceBuffer = (uint8_t *)malloc(otInstanceBufferLength);
|
||||
assert(otInstanceBuffer);
|
||||
|
||||
// Initialize Openthread with the buffer
|
||||
instance = otInstanceInit(otInstanceBuffer, &otInstanceBufferLength);
|
||||
#else
|
||||
instance = otInstanceInit();
|
||||
#endif
|
||||
|
||||
VerifyOrQuit(instance != NULL, "Failed to get and init an otInstance.\n");
|
||||
|
||||
for (int i = 0; i < kNumTestMessages; i++)
|
||||
@@ -251,6 +267,11 @@ void TestMessageQueueOtApis(void)
|
||||
// Remove all element and make sure queue is empty
|
||||
SuccessOrQuit(otMessageQueueDequeue(&queue, msg[2]), "Failed to dequeue a message from otMessageQueue.\n");
|
||||
VerifyMessageQueueContentUsingOtApi(&queue, 0);
|
||||
|
||||
otInstanceFinalize(instance);
|
||||
#ifdef OPENTHREAD_MULTIPLE_INSTANCE
|
||||
free(otInstanceBuffer);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef ENABLE_TEST_MAIN
|
||||
|
||||
Reference in New Issue
Block a user