aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/common-eval-args.cc
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2022-02-28 18:04:39 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2022-02-28 18:29:33 +0000
commitc863e5f338947ecff275a67725ecf50b2a47bdb5 (patch)
tree733893d760809edcbc55c7aa8078ab84fcd2aa73 /src/libexpr/common-eval-args.cc
parent7869be49c2735280ceabbd13c087b4a06444ae63 (diff)
parentb592359c565e0220545ba146b32f367e4ecdb23f (diff)
Merge remote-tracking branch 'upstream/master' into trustless-remote-builder-simple
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));
}
}