From e54b640e0ba77b0126e928aa5fe6ed318cb927de Mon Sep 17 00:00:00 2001 From: Mat M Date: Sun, 19 Apr 2020 01:57:57 -0400 Subject: [PATCH] nwm/nwm_uds: Avoid copying all elements in channel_data map where applicable (#5236) By using a reference here, we avoid copying every single element in the map, each of which contains a std::share_ptr and std::deque containing std::vectors. --- src/core/hle/service/nwm/nwm_uds.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/hle/service/nwm/nwm_uds.cpp b/src/core/hle/service/nwm/nwm_uds.cpp index cba699f25..ece667396 100644 --- a/src/core/hle/service/nwm/nwm_uds.cpp +++ b/src/core/hle/service/nwm/nwm_uds.cpp @@ -554,7 +554,7 @@ void NWM_UDS::Shutdown(Kernel::HLERequestContext& ctx) { initialized = false; - for (auto bind_node : channel_data) { + for (auto& bind_node : channel_data) { bind_node.second.event->Signal(); } channel_data.clear(); @@ -963,7 +963,7 @@ void NWM_UDS::DestroyNetwork(Kernel::HLERequestContext& ctx) { IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); - for (auto bind_node : channel_data) { + for (auto& bind_node : channel_data) { bind_node.second.event->Signal(); } channel_data.clear(); @@ -1009,7 +1009,7 @@ void NWM_UDS::DisconnectNetwork(Kernel::HLERequestContext& ctx) { SendPacket(deauth); - for (auto bind_node : channel_data) { + for (auto& bind_node : channel_data) { bind_node.second.event->Signal(); } channel_data.clear();