From 86126d6c893465585c459fa8a39601f73d69a39d Mon Sep 17 00:00:00 2001 From: skye Date: Fri, 3 Apr 2026 12:54:21 -0400 Subject: [PATCH] libexpr: Migrate EvalPaths::allowAndSetStorePathString to return a Value Part of #1136 Change-Id: Icf16109a63f1b8114e0af9db0a9213c46a6a6964 --- lix/libexpr/eval.cc | 4 ++-- lix/libexpr/eval.hh | 2 +- lix/libexpr/primops.cc | 6 +++--- lix/libexpr/primops/fetchTree.cc | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lix/libexpr/eval.cc b/lix/libexpr/eval.cc index 4b77776bb..75ccb0948 100644 --- a/lix/libexpr/eval.cc +++ b/lix/libexpr/eval.cc @@ -434,11 +434,11 @@ void EvalPaths::allowPath(const StorePath & storePath) allowPath(store->toRealPath(storePath)); } -void EvalPaths::allowAndSetStorePathString(const StorePath & storePath, Value & v) +Value EvalPaths::allowAndSetStorePathString(const StorePath & storePath) { allowPath(storePath); - v = mkStorePathString(storePath); + return mkStorePathString(storePath); } CheckedSourcePath EvalPaths::checkSourcePath(const SourcePath & path_) diff --git a/lix/libexpr/eval.hh b/lix/libexpr/eval.hh index ab8ed11b9..d087a2e6b 100644 --- a/lix/libexpr/eval.hh +++ b/lix/libexpr/eval.hh @@ -370,7 +370,7 @@ public: /** * Allow access to a store path and return it as a string. */ - void allowAndSetStorePathString(const StorePath & storePath, Value & v); + Value allowAndSetStorePathString(const StorePath & storePath); /** * Check whether access to a path is allowed and throw an error if diff --git a/lix/libexpr/primops.cc b/lix/libexpr/primops.cc index 0c1c52055..b617f9fe5 100644 --- a/lix/libexpr/primops.cc +++ b/lix/libexpr/primops.cc @@ -1659,7 +1659,7 @@ static void prim_toFile(EvalState & state, Value * * args, Value & v) used in args[1]. */ /* Add the output of this to the allowed paths. */ - state.ctx.paths.allowAndSetStorePathString(storePath, v); + v = state.ctx.paths.allowAndSetStorePathString(storePath); } static void addPath( @@ -1746,9 +1746,9 @@ static void addPath( "store path mismatch in (possibly filtered) path added from '%s'", path ).debugThrow(); - state.ctx.paths.allowAndSetStorePathString(dstPath, v); + v = state.ctx.paths.allowAndSetStorePathString(dstPath); } else - state.ctx.paths.allowAndSetStorePathString(*expectedStorePath, v); + v = state.ctx.paths.allowAndSetStorePathString(*expectedStorePath); } catch (Error & e) { e.addTrace(nullptr, "while adding path '%s'", path); throw; diff --git a/lix/libexpr/primops/fetchTree.cc b/lix/libexpr/primops/fetchTree.cc index 31fa3a248..febd837a0 100644 --- a/lix/libexpr/primops/fetchTree.cc +++ b/lix/libexpr/primops/fetchTree.cc @@ -299,7 +299,7 @@ static void fetch(EvalState & state, const PosIdx pos, Value * * args, Value & v }); if (state.aio.blockOn(state.ctx.store->isValidPath(expectedPath))) { - state.ctx.paths.allowAndSetStorePathString(expectedPath, v); + v = state.ctx.paths.allowAndSetStorePathString(expectedPath); return; } } @@ -331,7 +331,7 @@ static void fetch(EvalState & state, const PosIdx pos, Value * * args, Value & v } } - state.ctx.paths.allowAndSetStorePathString(storePath, v); + v = state.ctx.paths.allowAndSetStorePathString(storePath); } void prim_fetchurl(EvalState & state, Value * * args, Value & v)