aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/common-eval-args.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libexpr/common-eval-args.cc')
-rw-r--r--src/libexpr/common-eval-args.cc19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/libexpr/common-eval-args.cc b/src/libexpr/common-eval-args.cc
index fb0932c00..e50ff244c 100644
--- a/src/libexpr/common-eval-args.cc
+++ b/src/libexpr/common-eval-args.cc
@@ -73,30 +73,29 @@ MixEvalArgs::MixEvalArgs()
Bindings * MixEvalArgs::getAutoArgs(EvalState & state)
{
- Bindings * res = state.allocBindings(autoArgs.size());
+ auto res = state.buildBindings(autoArgs.size());
for (auto & i : autoArgs) {
- Value * v = state.allocValue();
+ auto v = state.allocValue();
if (i.second[0] == 'E')
- state.mkThunk_(*v, state.parseExprFromString(string(i.second, 1), absPath(".")));
+ state.mkThunk_(*v, state.parseExprFromString(i.second.substr(1), absPath(".")));
else
- mkString(*v, string(i.second, 1));
- res->push_back(Attr(state.symbols.create(i.first), v));
+ v->mkString(((std::string_view) i.second).substr(1));
+ res.insert(state.symbols.create(i.first), v);
}
- res->sort();
- return res;
+ return res.finish();
}
-Path lookupFileArg(EvalState & state, string s)
+Path lookupFileArg(EvalState & state, std::string_view s)
{
if (isUri(s)) {
return state.store->toRealPath(
fetchers::downloadTarball(
state.store, resolveUri(s), "source", false).first.storePath);
} else if (s.size() > 2 && s.at(0) == '<' && s.at(s.size() - 1) == '>') {
- Path p = s.substr(1, s.size() - 2);
+ Path p(s.substr(1, s.size() - 2));
return state.findFile(p);
} else
- return absPath(s);
+ return absPath(std::string(s));
}
}