From 16ddb157d04722c1a60f04552de89698e074e6b9 Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Thu, 16 Jun 2022 10:47:37 -0700 Subject: [PATCH] [dns-dso] use `Array::RemoveMatching()` (#7817) --- src/core/net/dns_dso.cpp | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/core/net/dns_dso.cpp b/src/core/net/dns_dso.cpp index 27222baf5..a18b45938 100644 --- a/src/core/net/dns_dso.cpp +++ b/src/core/net/dns_dso.cpp @@ -1409,20 +1409,7 @@ exit: void Dso::Connection::PendingRequests::Remove(MessageId aMessageId) { - Entry *entry = mRequests.FindMatching(aMessageId); - Entry *lastEntry; - - VerifyOrExit(entry != nullptr); - - // Remove last entry from the `mRequests` array, if it is not the - // `entry` we want to remove, replace `entry` with `lastEntry. - - lastEntry = mRequests.PopBack(); - VerifyOrExit(lastEntry != entry); - *entry = *lastEntry; - -exit: - return; + mRequests.RemoveMatching(aMessageId); } bool Dso::Connection::PendingRequests::HasAnyTimedOut(TimeMilli aNow) const