From f9a26d468c2388269eb63c3baf6c35762c594932 Mon Sep 17 00:00:00 2001
From: Lioncash <mathew1800@gmail.com>
Date: Mon, 20 Aug 2018 17:36:41 -0400
Subject: [PATCH] profile_manager: Take ProfileInfo by const reference where
 applicable

ProfileInfo is quite a large struct in terms of data, and we don't need
to perform a copy in these instances, so we can just pass constant
references instead.
---
 src/core/hle/service/acc/profile_manager.cpp | 8 ++++----
 src/core/hle/service/acc/profile_manager.h   | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/core/hle/service/acc/profile_manager.cpp b/src/core/hle/service/acc/profile_manager.cpp
index e1ab0e5591..beba92f640 100644
--- a/src/core/hle/service/acc/profile_manager.cpp
+++ b/src/core/hle/service/acc/profile_manager.cpp
@@ -53,7 +53,7 @@ bool ProfileManager::RemoveProfileAtIndex(size_t index) {
 }
 
 /// Helper function to register a user to the system
-ResultCode ProfileManager::AddUser(ProfileInfo user) {
+ResultCode ProfileManager::AddUser(const ProfileInfo& user) {
     if (AddToProfiles(user) == boost::none) {
         return ERROR_TOO_MANY_USERS;
     }
@@ -112,7 +112,7 @@ boost::optional<size_t> ProfileManager::GetUserIndex(const UUID& uuid) const {
 }
 
 /// Returns a users profile index based on their profile
-boost::optional<size_t> ProfileManager::GetUserIndex(ProfileInfo user) const {
+boost::optional<size_t> ProfileManager::GetUserIndex(const ProfileInfo& user) const {
     return GetUserIndex(user.user_uuid);
 }
 
@@ -135,7 +135,7 @@ bool ProfileManager::GetProfileBase(UUID uuid, ProfileBase& profile) const {
 }
 
 /// Returns the data structure used by the switch when GetProfileBase is called on acc:*
-bool ProfileManager::GetProfileBase(ProfileInfo user, ProfileBase& profile) const {
+bool ProfileManager::GetProfileBase(const ProfileInfo& user, ProfileBase& profile) const {
     return GetProfileBase(user.user_uuid, profile);
 }
 
@@ -221,7 +221,7 @@ bool ProfileManager::GetProfileBaseAndData(UUID uuid, ProfileBase& profile,
 }
 
 /// Return the users profile base and the unknown arbitary data.
-bool ProfileManager::GetProfileBaseAndData(ProfileInfo user, ProfileBase& profile,
+bool ProfileManager::GetProfileBaseAndData(const ProfileInfo& user, ProfileBase& profile,
                                            std::array<u8, MAX_DATA>& data) const {
     return GetProfileBaseAndData(user.user_uuid, profile, data);
 }
diff --git a/src/core/hle/service/acc/profile_manager.h b/src/core/hle/service/acc/profile_manager.h
index 49dc3a6e38..d38f671885 100644
--- a/src/core/hle/service/acc/profile_manager.h
+++ b/src/core/hle/service/acc/profile_manager.h
@@ -78,19 +78,19 @@ static_assert(sizeof(ProfileBase) == 0x38, "ProfileBase is an invalid size");
 class ProfileManager {
 public:
     ProfileManager(); // TODO(ogniK): Load from system save
-    ResultCode AddUser(ProfileInfo user);
+    ResultCode AddUser(const ProfileInfo& user);
     ResultCode CreateNewUser(UUID uuid, const std::array<u8, 0x20>& username);
     ResultCode CreateNewUser(UUID uuid, const std::string& username);
     boost::optional<size_t> GetUserIndex(const UUID& uuid) const;
-    boost::optional<size_t> GetUserIndex(ProfileInfo user) const;
+    boost::optional<size_t> GetUserIndex(const ProfileInfo& user) const;
     bool GetProfileBase(boost::optional<size_t> index, ProfileBase& profile) const;
     bool GetProfileBase(UUID uuid, ProfileBase& profile) const;
-    bool GetProfileBase(ProfileInfo user, ProfileBase& profile) const;
+    bool GetProfileBase(const ProfileInfo& user, ProfileBase& profile) const;
     bool GetProfileBaseAndData(boost::optional<size_t> index, ProfileBase& profile,
                                std::array<u8, MAX_DATA>& data) const;
     bool GetProfileBaseAndData(UUID uuid, ProfileBase& profile,
                                std::array<u8, MAX_DATA>& data) const;
-    bool GetProfileBaseAndData(ProfileInfo user, ProfileBase& profile,
+    bool GetProfileBaseAndData(const ProfileInfo& user, ProfileBase& profile,
                                std::array<u8, MAX_DATA>& data) const;
     size_t GetUserCount() const;
     size_t GetOpenUserCount() const;