[child-table] enhance address iterator method (#6118)

Moving the if statement out of the loop always brings the same result.
This commit is contained in:
Li Cao
2021-01-28 10:43:57 -08:00
committed by GitHub
parent 563e2a0801
commit 2a3f13e1c7
+5 -5
View File
@@ -255,13 +255,13 @@ void Child::AddressIterator::Update(void)
{
const Ip6::Address *address;
if ((mIndex == 0) && (mChild.GetMeshLocalIp6Address(mMeshLocalAddress) != OT_ERROR_NONE))
{
mIndex++;
}
while (true)
{
if ((mIndex == 0) && (mChild.GetMeshLocalIp6Address(mMeshLocalAddress) != OT_ERROR_NONE))
{
mIndex++;
}
address = GetAddress();
VerifyOrExit((address != nullptr) && !address->IsUnspecified(), mIndex = kMaxIndex);