Fix another range-for loop with an implicit copy.
Also employ the awesome C++17 structured binding feature to unpack the pair.
Test: atest netd_unit_test
Change-Id: Ie7a0d9643c81a702d06557b9352d4d11b01c71d2
diff --git a/server/NFLogListener.cpp b/server/NFLogListener.cpp
index f13fcf7..e1615ff 100644
--- a/server/NFLogListener.cpp
+++ b/server/NFLogListener.cpp
@@ -169,8 +169,8 @@
expectOk(mListener->unsubscribe(kNFLogPacketMsgType));
expectOk(mListener->unsubscribe(kNetlinkDoneMsgType));
const auto sendFn = [this](const Slice msg) { return mListener->send(msg); };
- for (auto pair : mDispatchMap) {
- expectOk(cfgCmdUnbind(sendFn, pair.first));
+ for (const auto& [key, value] : mDispatchMap) {
+ expectOk(cfgCmdUnbind(sendFn, key));
}
}