Directory: pass std::string&& to constructor

This commit is contained in:
Max Kellermann 2014-02-23 22:02:02 +01:00
parent 5f5c95cc68
commit db20e29af6
2 changed files with 4 additions and 4 deletions

View File

@ -41,10 +41,10 @@ extern "C" {
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
Directory::Directory(const char *_path_utf8, Directory *_parent) Directory::Directory(std::string &&_path_utf8, Directory *_parent)
:parent(_parent), :parent(_parent),
mtime(0), have_stat(false), mtime(0), have_stat(false),
path(_path_utf8) path(std::move(_path_utf8))
{ {
INIT_LIST_HEAD(&children); INIT_LIST_HEAD(&children);
INIT_LIST_HEAD(&songs); INIT_LIST_HEAD(&songs);

View File

@ -85,7 +85,7 @@ struct Directory {
std::string path; std::string path;
public: public:
Directory(const char *_path_utf8, Directory *_parent); Directory(std::string &&_path_utf8, Directory *_parent);
~Directory(); ~Directory();
/** /**
@ -93,7 +93,7 @@ public:
*/ */
gcc_malloc gcc_malloc
static Directory *NewRoot() { static Directory *NewRoot() {
return new Directory("", nullptr); return new Directory(std::string(), nullptr);
} }
/** /**