civodul pushed a commit to branch nix
in repository guix.
commit c51374c128cbe1f06acd95ba2d627a118a95aabf
Author: Eelco Dolstra <[email protected]>
Date: Fri Aug 1 17:30:51 2014 +0200
Eliminate redundant copy
---
nix/libutil/util.cc | 2 +-
nix/libutil/util.hh | 2 ++
2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/nix/libutil/util.cc b/nix/libutil/util.cc
index 3f9c697..06c8441 100644
--- a/nix/libutil/util.cc
+++ b/nix/libutil/util.cc
@@ -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);
diff --git a/nix/libutil/util.hh b/nix/libutil/util.hh
index 462b98e..cf513c0 100644
--- a/nix/libutil/util.hh
+++ b/nix/libutil/util.hh
@@ -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;