aboutsummaryrefslogtreecommitdiff
path: root/src/libcmd/installables.cc
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-06-16 23:10:09 +0200
committereldritch horrors <pennae@lix.systems>2024-06-17 19:46:44 +0000
commitad5366c2ad43216ac9a61ccb1477ff9859d1a75c (patch)
treee986b1f0e9510641279bba164b36bae9a96be6be /src/libcmd/installables.cc
parentb8f49a8eaf619df6d228f2e0f9814c4a5fa4aec5 (diff)
libexpr: pass Exprs as references, not pointers
almost all places where Exprs are passed as pointers expect the pointers to be non-null. pass them as references to encode this constraint in the type system as well (and also communicate that Exprs must not be freed). Change-Id: Ia98f166fec3c23151f906e13acb4a0954a5980a2
Diffstat (limited to 'src/libcmd/installables.cc')
-rw-r--r--src/libcmd/installables.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libcmd/installables.cc b/src/libcmd/installables.cc
index ab0e4fd1c..a10214561 100644
--- a/src/libcmd/installables.cc
+++ b/src/libcmd/installables.cc
@@ -214,7 +214,7 @@ void SourceExprCommand::completeInstallable(AddCompletions & completions, std::s
evalSettings.pureEval = false;
auto state = getEvalState();
- Expr *e = state->parseExprFromFile(
+ Expr & e = state->parseExprFromFile(
resolveExprPath(state->checkSourcePath(lookupFileArg(*state, *file)))
);
@@ -434,13 +434,13 @@ Installables SourceExprCommand::parseInstallables(
auto vFile = state->allocValue();
if (file == "-") {
- auto e = state->parseStdin();
+ auto & e = state->parseStdin();
state->eval(e, *vFile);
}
else if (file)
state->evalFile(lookupFileArg(*state, *file), *vFile);
else {
- auto e = state->parseExprFromString(*expr, state->rootPath(CanonPath::fromCwd()));
+ auto & e = state->parseExprFromString(*expr, state->rootPath(CanonPath::fromCwd()));
state->eval(e, *vFile);
}