mirror of
https://github.com/yuzu-mirror/yuzu.git
synced 2024-11-17 13:37:33 +01:00
vfs_offset: std::move file and name parameters of OffsetVfsFile
Avoids potentially unnecessary atomic reference count incrementing and decrementing, as well as string copying.
This commit is contained in:
parent
d3cfaf95c8
commit
0e9d58e82a
@ -2,13 +2,15 @@
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "core/file_sys/vfs_offset.h"
|
||||
|
||||
namespace FileSys {
|
||||
|
||||
OffsetVfsFile::OffsetVfsFile(std::shared_ptr<VfsFile> file_, size_t size_, size_t offset_,
|
||||
const std::string& name_)
|
||||
: file(file_), offset(offset_), size(size_), name(name_) {}
|
||||
std::string name_)
|
||||
: file(std::move(file_)), offset(offset_), size(size_), name(std::move(name_)) {}
|
||||
|
||||
std::string OffsetVfsFile::GetName() const {
|
||||
return name.empty() ? file->GetName() : name;
|
||||
|
@ -14,7 +14,7 @@ namespace FileSys {
|
||||
// the size of this wrapper.
|
||||
struct OffsetVfsFile : public VfsFile {
|
||||
OffsetVfsFile(std::shared_ptr<VfsFile> file, size_t size, size_t offset = 0,
|
||||
const std::string& new_name = "");
|
||||
std::string new_name = "");
|
||||
|
||||
std::string GetName() const override;
|
||||
size_t GetSize() const override;
|
||||
|
Loading…
Reference in New Issue
Block a user