From c37dc23481dcbd630a2fceaf72f6d3a564e57403 Mon Sep 17 00:00:00 2001 From: FearlessTobi Date: Sat, 5 Dec 2020 23:07:08 +0100 Subject: [PATCH] udp/client: Take std::function by const reference with TestCommunication() Avoids redundant copies. Co-Authored-By: LC <712067+lioncash@users.noreply.github.com> --- src/input_common/udp/client.cpp | 4 ++-- src/input_common/udp/client.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/input_common/udp/client.cpp b/src/input_common/udp/client.cpp index 0c2f82fcb..a1e55fc76 100644 --- a/src/input_common/udp/client.cpp +++ b/src/input_common/udp/client.cpp @@ -210,8 +210,8 @@ void Client::StartCommunication(const std::string& host, u16 port, u8 pad_index, } void TestCommunication(const std::string& host, u16 port, u8 pad_index, u32 client_id, - std::function success_callback, - std::function failure_callback) { + const std::function& success_callback, + const std::function& failure_callback) { std::thread([=] { Common::Event success_event; SocketCallback callback{[](Response::Version version) {}, [](Response::PortInfo info) {}, diff --git a/src/input_common/udp/client.h b/src/input_common/udp/client.h index b8c654755..e049d4039 100644 --- a/src/input_common/udp/client.h +++ b/src/input_common/udp/client.h @@ -89,7 +89,7 @@ private: }; void TestCommunication(const std::string& host, u16 port, u8 pad_index, u32 client_id, - std::function success_callback, - std::function failure_callback); + const std::function& success_callback, + const std::function& failure_callback); } // namespace InputCommon::CemuhookUDP