summaryrefslogtreecommitdiff
path: root/Source/Core/Common/Debug
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2019-07-08 17:28:07 -0400
committerLioncash <mathew1800@gmail.com>2019-07-08 17:41:06 -0400
commitbc8778203eefcfca0597abc286de3c36edfbe6e5 (patch)
treeb39d0bab1ad4f5decd2cb56e1ba61dc334792329 /Source/Core/Common/Debug
parent0a7395bfba99719f71de5186a9916e66c1901f37 (diff)
Common/Watches: std::move strings where applicable
Allows calling code to move the std::string into the Watch instances, avoiding copies.
Diffstat (limited to 'Source/Core/Common/Debug')
-rw-r--r--Source/Core/Common/Debug/Watches.cpp16
-rw-r--r--Source/Core/Common/Debug/Watches.h8
2 files changed, 12 insertions, 12 deletions
diff --git a/Source/Core/Common/Debug/Watches.cpp b/Source/Core/Common/Debug/Watches.cpp
index 3668af1626..9114f2e83d 100644
--- a/Source/Core/Common/Debug/Watches.cpp
+++ b/Source/Core/Common/Debug/Watches.cpp
@@ -9,12 +9,12 @@
namespace Common::Debug
{
-Watch::Watch(u32 address_, const std::string& name_, Watch::State is_enabled_)
- : address(address_), name(name_), is_enabled(is_enabled_)
+Watch::Watch(u32 address_, std::string name_, State is_enabled_)
+ : address(address_), name(std::move(name_)), is_enabled(is_enabled_)
{
}
-std::size_t Watches::SetWatch(u32 address, const std::string& name)
+std::size_t Watches::SetWatch(u32 address, std::string name)
{
const std::size_t size = m_watches.size();
for (std::size_t index = 0; index < size; index++)
@@ -25,7 +25,7 @@ std::size_t Watches::SetWatch(u32 address, const std::string& name)
return index;
}
}
- m_watches.emplace_back(address, name, Watch::State::Enabled);
+ m_watches.emplace_back(address, std::move(name), Watch::State::Enabled);
return size;
}
@@ -46,10 +46,10 @@ void Watches::UnsetWatch(u32 address)
m_watches.end());
}
-void Watches::UpdateWatch(std::size_t index, u32 address, const std::string& name)
+void Watches::UpdateWatch(std::size_t index, u32 address, std::string name)
{
m_watches[index].address = address;
- m_watches[index].name = name;
+ m_watches[index].name = std::move(name);
}
void Watches::UpdateWatchAddress(std::size_t index, u32 address)
@@ -57,9 +57,9 @@ void Watches::UpdateWatchAddress(std::size_t index, u32 address)
m_watches[index].address = address;
}
-void Watches::UpdateWatchName(std::size_t index, const std::string& name)
+void Watches::UpdateWatchName(std::size_t index, std::string name)
{
- m_watches[index].name = name;
+ m_watches[index].name = std::move(name);
}
void Watches::EnableWatch(std::size_t index)
diff --git a/Source/Core/Common/Debug/Watches.h b/Source/Core/Common/Debug/Watches.h
index 1134f20900..fcf5c795bf 100644
--- a/Source/Core/Common/Debug/Watches.h
+++ b/Source/Core/Common/Debug/Watches.h
@@ -24,19 +24,19 @@ struct Watch
std::string name;
State is_enabled;
- Watch(u32 address, const std::string& name, State is_enabled);
+ Watch(u32 address, std::string name, State is_enabled);
};
class Watches
{
public:
- std::size_t SetWatch(u32 address, const std::string& name);
+ std::size_t SetWatch(u32 address, std::string name);
const Watch& GetWatch(std::size_t index) const;
const std::vector<Watch>& GetWatches() const;
void UnsetWatch(u32 address);
- void UpdateWatch(std::size_t index, u32 address, const std::string& name);
+ void UpdateWatch(std::size_t index, u32 address, std::string name);
void UpdateWatchAddress(std::size_t index, u32 address);
- void UpdateWatchName(std::size_t index, const std::string& name);
+ void UpdateWatchName(std::size_t index, std::string name);
void EnableWatch(std::size_t index);
void DisableWatch(std::size_t index);
bool HasEnabledWatch(u32 address) const;