Eliminate redundant copy

This commit is contained in:
Eelco Dolstra 2014-08-01 17:30:51 +02:00
parent e0d7d0e45c
commit eea0401d7a
2 changed files with 3 additions and 1 deletions

View file

@ -216,7 +216,7 @@ DirEntries readDirectory(const Path & path)
checkInterrupt();
string name = dirent->d_name;
if (name == "." || name == "..") continue;
entries.emplace_back(DirEntry({ name, dirent->d_ino, dirent->d_type }));
entries.emplace_back(name, dirent->d_ino, dirent->d_type);
}
if (errno) throw SysError(format("reading directory `%1%'") % path);

View file

@ -69,6 +69,8 @@ struct DirEntry
string name;
ino_t ino;
unsigned char type; // one of DT_*
DirEntry(const string & name, ino_t ino, unsigned char type)
: name(name), ino(ino), type(type) { }
};
typedef vector<DirEntry> DirEntries;