1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-28 17:51:15 +02:00

Store Attrs inside Bindings

This prevents a double allocation per attribute set.
This commit is contained in:
Eelco Dolstra 2014-09-19 16:49:41 +02:00
parent 0342eb1705
commit 5b58991a71
9 changed files with 101 additions and 60 deletions

View file

@ -25,17 +25,19 @@ bool parseAutoArgs(Strings::iterator & i,
}
void evalAutoArgs(EvalState & state, std::map<string, string> & in, Bindings & out)
Bindings * evalAutoArgs(EvalState & state, std::map<string, string> & in)
{
for (auto & i: in) {
Bindings * res = state.allocBindings(in.size());
for (auto & i : in) {
Value * v = state.allocValue();
if (i.second[0] == 'E')
state.mkThunk_(*v, state.parseExprFromString(string(i.second, 1), absPath(".")));
else
mkString(*v, string(i.second, 1));
out.push_back(Attr(state.symbols.create(i.first), v));
res->push_back(Attr(state.symbols.create(i.first), v));
}
out.sort();
res->sort();
return res;
}