Skip to content

Commit

Permalink
SysConf: std::move name in Entry constructor
Browse files Browse the repository at this point in the history
Allows code to move into the constructor, avoiding copies entirely.
  • Loading branch information
lioncash committed Dec 30, 2020
1 parent 05094ab commit 1bbfde6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Source/Core/Core/SysConf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,14 @@ bool SysConf::Save() const
return result == IOS::HLE::FS::ResultCode::Success;
}

SysConf::Entry::Entry(Type type_, const std::string& name_) : type(type_), name(name_)
SysConf::Entry::Entry(Type type_, std::string name_) : type(type_), name(std::move(name_))
{
if (type != Type::SmallArray && type != Type::BigArray)
bytes.resize(GetNonArrayEntrySize(type));
}

SysConf::Entry::Entry(Type type_, const std::string& name_, std::vector<u8> bytes_)
: type(type_), name(name_), bytes(std::move(bytes_))
SysConf::Entry::Entry(Type type_, std::string name_, std::vector<u8> bytes_)
: type(type_), name(std::move(name_)), bytes(std::move(bytes_))
{
}

Expand Down
4 changes: 2 additions & 2 deletions Source/Core/Core/SysConf.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ class SysConf final
ByteBool = 7,
};

Entry(Type type_, const std::string& name_);
Entry(Type type_, const std::string& name_, std::vector<u8> bytes_);
Entry(Type type_, std::string name_);
Entry(Type type_, std::string name_, std::vector<u8> bytes_);

// Intended for use with the non array types.
template <typename T>
Expand Down

0 comments on commit 1bbfde6

Please sign in to comment.