about summary refs log tree commit diff
path: root/src/nix-env/nix-env.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-09-19T14·49+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-09-19T14·49+0200
commit5b58991a71d15123c010bbbd7f08530dbc31173f (patch)
tree3cec3413ee43ddd8b46b950022e0741a7c166fd7 /src/nix-env/nix-env.cc
parent0342eb170500f726f11269d26a1f34cded5d3676 (diff)
Store Attrs inside Bindings
This prevents a double allocation per attribute set.
Diffstat (limited to 'src/nix-env/nix-env.cc')
-rw-r--r--src/nix-env/nix-env.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc
index 5116d955fe09..c24165da8f1d 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", "");