mirror of
https://github.com/espressif/openthread.git
synced 2026-08-15 15:17:46 +00:00
[message] simplify method for allocating new message from pool (#7210)
This commit removes different `MessagePool` methods that can be used to allocate a new message and combines them into one `Allocate()` method which uses `Message::Settings`. The `Message::Settings` is also updated to provide new constructor initializing it with a given message priority only.
This commit is contained in:
@@ -142,7 +142,7 @@ void TestDnsName(void)
|
||||
VerifyOrQuit(instance != nullptr, "Null OpenThread instance");
|
||||
|
||||
messagePool = &instance->Get<MessagePool>();
|
||||
VerifyOrQuit((message = messagePool->New(Message::kTypeIp6, 0)) != nullptr, "Message::New failed");
|
||||
VerifyOrQuit((message = messagePool->Allocate(Message::kTypeIp6)) != nullptr);
|
||||
|
||||
message->SetOffset(0);
|
||||
|
||||
@@ -468,7 +468,7 @@ void TestDnsCompressedName(void)
|
||||
VerifyOrQuit(instance != nullptr, "Null OpenThread instance");
|
||||
|
||||
messagePool = &instance->Get<MessagePool>();
|
||||
VerifyOrQuit((message = messagePool->New(Message::kTypeIp6, 0)) != nullptr);
|
||||
VerifyOrQuit((message = messagePool->Allocate(Message::kTypeIp6)) != nullptr);
|
||||
|
||||
// Append name1 "F.ISI.ARPA"
|
||||
|
||||
@@ -729,7 +729,7 @@ void TestDnsCompressedName(void)
|
||||
printf("----------------------------------------------------------------\n");
|
||||
printf("Append names from one message to another\n");
|
||||
|
||||
VerifyOrQuit((message2 = messagePool->New(Message::kTypeIp6, 0)) != nullptr);
|
||||
VerifyOrQuit((message2 = messagePool->Allocate(Message::kTypeIp6)) != nullptr);
|
||||
|
||||
dnsName1.SetFromMessage(*message, name1Offset);
|
||||
dnsName2.SetFromMessage(*message, name2Offset);
|
||||
@@ -830,7 +830,7 @@ void TestHeaderAndResourceRecords(void)
|
||||
VerifyOrQuit(instance != nullptr, "Null OpenThread instance");
|
||||
|
||||
messagePool = &instance->Get<MessagePool>();
|
||||
VerifyOrQuit((message = messagePool->New(Message::kTypeIp6, 0)) != nullptr);
|
||||
VerifyOrQuit((message = messagePool->Allocate(Message::kTypeIp6)) != nullptr);
|
||||
|
||||
printf("----------------------------------------------------------------\n");
|
||||
printf("Preparing the message\n");
|
||||
@@ -1245,7 +1245,7 @@ void TestDnsTxtEntry(void)
|
||||
VerifyOrQuit(instance != nullptr);
|
||||
|
||||
messagePool = &instance->Get<MessagePool>();
|
||||
VerifyOrQuit((message = messagePool->New(Message::kTypeIp6, 0)) != nullptr);
|
||||
VerifyOrQuit((message = messagePool->Allocate(Message::kTypeIp6)) != nullptr);
|
||||
|
||||
data.Init(txtData, sizeof(txtData));
|
||||
SuccessOrQuit(Dns::TxtEntry::AppendEntries(kTxtEntries, OT_ARRAY_LENGTH(kTxtEntries), data));
|
||||
|
||||
Reference in New Issue
Block a user