aboutsummaryrefslogtreecommitdiff
path: root/src/nix-env
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-09-19 16:49:41 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-09-19 16:49:41 +0200
commit5b58991a71d15123c010bbbd7f08530dbc31173f (patch)
tree3cec3413ee43ddd8b46b950022e0741a7c166fd7 /src/nix-env
parent0342eb170500f726f11269d26a1f34cded5d3676 (diff)
Store Attrs inside Bindings
This prevents a double allocation per attribute set.
Diffstat (limited to 'src/nix-env')
-rw-r--r--src/nix-env/nix-env.cc14
-rw-r--r--src/nix-env/user-env.cc2
2 files changed, 8 insertions, 8 deletions
diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc
index 5116d955f..c24165da8 100644
--- a/src/nix-env/nix-env.cc
+++ b/src/nix-env/nix-env.cc
@@ -44,7 +44,7 @@ struct InstallSourceInfo
Path nixExprPath; /* for srcNixExprDrvs, srcNixExprs */
Path profile; /* for srcProfile */
string systemFilter; /* for srcNixExprDrvs */
- Bindings autoArgs;
+ Bindings * autoArgs;
};
@@ -350,7 +350,7 @@ static void queryInstSources(EvalState & state,
Nix expression. */
DrvInfos allElems;
loadDerivations(state, instSource.nixExprPath,
- instSource.systemFilter, instSource.autoArgs, "", allElems);
+ instSource.systemFilter, *instSource.autoArgs, "", allElems);
elems = filterBySelector(state, allElems, args, newestOnly);
@@ -373,7 +373,7 @@ static void queryInstSources(EvalState & state,
Value vFun, vTmp;
state.eval(eFun, vFun);
mkApp(vTmp, vFun, vArg);
- getDerivations(state, vTmp, "", instSource.autoArgs, elems, true);
+ getDerivations(state, vTmp, "", *instSource.autoArgs, elems, true);
}
break;
@@ -423,8 +423,8 @@ static void queryInstSources(EvalState & state,
Value vRoot;
loadSourceExpr(state, instSource.nixExprPath, vRoot);
foreach (Strings::const_iterator, i, args) {
- Value & v(*findAlongAttrPath(state, *i, instSource.autoArgs, vRoot));
- getDerivations(state, v, "", instSource.autoArgs, elems, true);
+ Value & v(*findAlongAttrPath(state, *i, *instSource.autoArgs, vRoot));
+ getDerivations(state, v, "", *instSource.autoArgs, elems, true);
}
break;
}
@@ -926,7 +926,7 @@ static void opQuery(Globals & globals, Strings opFlags, Strings opArgs)
if (source == sAvailable || compareVersions)
loadDerivations(*globals.state, globals.instSource.nixExprPath,
- globals.instSource.systemFilter, globals.instSource.autoArgs,
+ globals.instSource.systemFilter, *globals.instSource.autoArgs,
attrPath, availElems);
DrvInfos elems_ = filterBySelector(*globals.state,
@@ -1423,7 +1423,7 @@ int main(int argc, char * * argv)
if (file != "")
globals.instSource.nixExprPath = lookupFileArg(*globals.state, file);
- evalAutoArgs(*globals.state, autoArgs_, globals.instSource.autoArgs);
+ globals.instSource.autoArgs = evalAutoArgs(*globals.state, autoArgs_);
if (globals.profile == "")
globals.profile = getEnv("NIX_PROFILE", "");
diff --git a/src/nix-env/user-env.cc b/src/nix-env/user-env.cc
index 3ebd6c1f2..3bc31b9ea 100644
--- a/src/nix-env/user-env.cc
+++ b/src/nix-env/user-env.cc
@@ -19,7 +19,7 @@ DrvInfos queryInstalled(EvalState & state, const Path & userEnv)
if (pathExists(manifestFile)) {
Value v;
state.evalFile(manifestFile, v);
- Bindings bindings;
+ Bindings & bindings(*state.allocBindings(0));
getDerivations(state, v, "", bindings, elems, false);
}
return elems;