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.
This commit is contained in:
Mat M 2020-04-19 01:57:57 -04:00 committed by GitHub
parent b96b7ab3f6
commit e54b640e0b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -554,7 +554,7 @@ void NWM_UDS::Shutdown(Kernel::HLERequestContext& ctx) {
initialized = false; initialized = false;
for (auto bind_node : channel_data) { for (auto& bind_node : channel_data) {
bind_node.second.event->Signal(); bind_node.second.event->Signal();
} }
channel_data.clear(); channel_data.clear();
@ -963,7 +963,7 @@ void NWM_UDS::DestroyNetwork(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
for (auto bind_node : channel_data) { for (auto& bind_node : channel_data) {
bind_node.second.event->Signal(); bind_node.second.event->Signal();
} }
channel_data.clear(); channel_data.clear();
@ -1009,7 +1009,7 @@ void NWM_UDS::DisconnectNetwork(Kernel::HLERequestContext& ctx) {
SendPacket(deauth); SendPacket(deauth);
for (auto bind_node : channel_data) { for (auto& bind_node : channel_data) {
bind_node.second.event->Signal(); bind_node.second.event->Signal();
} }
channel_data.clear(); channel_data.clear();