From b0df09335cce3f4a2c49bf27d23de85a3c0113dc Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 24 Nov 2018 00:04:07 -0500 Subject: service/sm: Take std::string by const reference in UnregisterService Avoids the need to create a copy of the std::string instance (potentially allocating). The only reason RegisterService takes its argument by value is because it's std::moved internally. --- src/core/hle/service/sm/sm.cpp | 2 +- src/core/hle/service/sm/sm.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core/hle') diff --git a/src/core/hle/service/sm/sm.cpp b/src/core/hle/service/sm/sm.cpp index c1b2f33b9..9ca8483a5 100644 --- a/src/core/hle/service/sm/sm.cpp +++ b/src/core/hle/service/sm/sm.cpp @@ -63,7 +63,7 @@ ResultVal> ServiceManager::RegisterService return MakeResult>(std::move(server_port)); } -ResultCode ServiceManager::UnregisterService(std::string name) { +ResultCode ServiceManager::UnregisterService(const std::string& name) { CASCADE_CODE(ValidateServiceName(name)); const auto iter = registered_services.find(name); diff --git a/src/core/hle/service/sm/sm.h b/src/core/hle/service/sm/sm.h index c4714b3e3..bef25433e 100644 --- a/src/core/hle/service/sm/sm.h +++ b/src/core/hle/service/sm/sm.h @@ -50,7 +50,7 @@ public: ResultVal> RegisterService(std::string name, unsigned int max_sessions); - ResultCode UnregisterService(std::string name); + ResultCode UnregisterService(const std::string& name); ResultVal> GetServicePort(const std::string& name); ResultVal> ConnectToService(const std::string& name); -- cgit v1.2.3