kernel/shared_memory: std::move the string parameter in SetName()

This avoids a potential reallocation.
This commit is contained in:
Lioncash 2018-11-24 10:07:04 -05:00
parent 210e558bea
commit 067f09b41d
No known key found for this signature in database
GPG Key ID: 4E3C3CC1031BA9C7

View File

@ -5,6 +5,7 @@
#pragma once #pragma once
#include <string> #include <string>
#include <utility>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/hle/kernel/object.h" #include "core/hle/kernel/object.h"
#include "core/hle/kernel/process.h" #include "core/hle/kernel/process.h"
@ -21,7 +22,7 @@ public:
return name; return name;
} }
void SetName(std::string name) { void SetName(std::string name) {
this->name = name; this->name = std::move(name);
} }
static const HandleType HANDLE_TYPE = HandleType::SharedMemory; static const HandleType HANDLE_TYPE = HandleType::SharedMemory;