Eliminate redundant copy
This commit is contained in:
parent
e0d7d0e45c
commit
eea0401d7a
2 changed files with 3 additions and 1 deletions
|
@ -216,7 +216,7 @@ DirEntries readDirectory(const Path & path)
|
||||||
checkInterrupt();
|
checkInterrupt();
|
||||||
string name = dirent->d_name;
|
string name = dirent->d_name;
|
||||||
if (name == "." || name == "..") continue;
|
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);
|
if (errno) throw SysError(format("reading directory `%1%'") % path);
|
||||||
|
|
||||||
|
|
|
@ -69,6 +69,8 @@ struct DirEntry
|
||||||
string name;
|
string name;
|
||||||
ino_t ino;
|
ino_t ino;
|
||||||
unsigned char type; // one of DT_*
|
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;
|
typedef vector<DirEntry> DirEntries;
|
||||||
|
|
Loading…
Reference in a new issue