Eliminate redundant copy

This commit is contained in:
Eelco Dolstra 2014-08-01 17:30:51 +02:00 committed by Ludovic Courtès
parent 666c9b7108
commit c51374c128
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;