mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
Common/Watches: std::move strings where applicable
Allows calling code to move the std::string into the Watch instances, avoiding copies.
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user