From fe38b58e506377f9a18bc6836d6aa975366690ea Mon Sep 17 00:00:00 2001 From: skye Date: Tue, 7 Apr 2026 21:19:06 -0400 Subject: [PATCH] libexpr/primops: Migrate helper fn fetch to return a Value Part of #1136 Change-Id: I5b21998d437aa82fb89e75b0b645269a6a6a6964 --- lix/libexpr/primops/fetchTree.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lix/libexpr/primops/fetchTree.cc b/lix/libexpr/primops/fetchTree.cc index 3df1bf8db..026eb435b 100644 --- a/lix/libexpr/primops/fetchTree.cc +++ b/lix/libexpr/primops/fetchTree.cc @@ -233,8 +233,9 @@ void prim_fetchTree(EvalState & state, Value * * args, Value & v) v = fetchTree(state, noPos, args, std::nullopt, FetchTreeParams{.allowNameArgument = false}); } -static void fetch(EvalState & state, const PosIdx pos, Value * * args, Value & v, - const std::string & who, bool unpack, std::string name) +static Value fetch( + EvalState & state, const PosIdx pos, Value ** args, const std::string & who, bool unpack, std::string name +) { std::optional url; std::optional expectedHash; @@ -299,8 +300,7 @@ static void fetch(EvalState & state, const PosIdx pos, Value * * args, Value & v }); if (state.aio.blockOn(state.ctx.store->isValidPath(expectedPath))) { - v = state.ctx.paths.allowAndSetStorePathString(expectedPath); - return; + return state.ctx.paths.allowAndSetStorePathString(expectedPath); } } @@ -331,17 +331,17 @@ static void fetch(EvalState & state, const PosIdx pos, Value * * args, Value & v } } - v = state.ctx.paths.allowAndSetStorePathString(storePath); + return state.ctx.paths.allowAndSetStorePathString(storePath); } void prim_fetchurl(EvalState & state, Value * * args, Value & v) { - fetch(state, noPos, args, v, "fetchurl", false, ""); + v = fetch(state, noPos, args, "fetchurl", false, ""); } void prim_fetchTarball(EvalState & state, Value * * args, Value & v) { - fetch(state, noPos, args, v, "fetchTarball", true, "source"); + v = fetch(state, noPos, args, "fetchTarball", true, "source"); } void prim_fetchGit(EvalState & state, Value * * args, Value & v)