From fe6dfa5ace6c39fb2763d7b4b78cc96ec1a1527f Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Sun, 28 Sep 2025 00:02:21 +0200 Subject: [PATCH] libexpr: remove unused return types Change-Id: Ief898b70f9781bd3dbe66734710f388daa2f2fed --- lix/libexpr/eval.cc | 18 +++++------------- lix/libexpr/eval.hh | 6 ++---- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/lix/libexpr/eval.cc b/lix/libexpr/eval.cc index 44a19a2b0..a43de745b 100644 --- a/lix/libexpr/eval.cc +++ b/lix/libexpr/eval.cc @@ -545,18 +545,11 @@ Path EvalPaths::toRealPath(const Path & path, const NixStringContext & context) : path; } - -Value * EvalBuiltins::addConstant(const std::string & name, const Value & v, Constant info) +void EvalBuiltins::addConstant(const std::string & name, const Value & v2, Constant info) { - Value * v2 = mem.allocValue(); - *v2 = v; - addConstant(name, v2, info); - return v2; -} + Value * v = mem.allocValue(); + *v = v2; - -void EvalBuiltins::addConstant(const std::string & name, Value * v, Constant info) -{ auto name2 = name.substr(0, 2) == "__" ? name.substr(2) : name; constantInfos.push_back({name2, info}); @@ -582,7 +575,7 @@ std::ostream & operator<<(std::ostream & output, const PrimOp & primOp) return output; } -Value * EvalBuiltins::addPrimOp(PrimOpDetails && primOp) +void EvalBuiltins::addPrimOp(PrimOpDetails && primOp) { /* Hack to make constants lazy: turn them into a application of the primop to a dummy value. */ @@ -591,7 +584,7 @@ Value * EvalBuiltins::addPrimOp(PrimOpDetails && primOp) auto vPrimOp = mem.allocValue(); vPrimOp->mkPrimOp(new PrimOp(std::move(primOp))); Value v{NewValueAs::app, mem, *vPrimOp, *vPrimOp}; - return addConstant( + addConstant( vPrimOp->primOp()->name, v, { @@ -610,7 +603,6 @@ Value * EvalBuiltins::addPrimOp(PrimOpDetails && primOp) staticEnv->vars.insert_or_assign(auto(envName), baseEnvDispl); env.values[baseEnvDispl++] = v; env.values[0]->attrs()->push_back(Attr(symbols.create(v->primOp()->name), v)); - return v; } diff --git a/lix/libexpr/eval.hh b/lix/libexpr/eval.hh index c714c4098..215a226ee 100644 --- a/lix/libexpr/eval.hh +++ b/lix/libexpr/eval.hh @@ -265,11 +265,9 @@ private: void createBaseEnv(const SearchPath & searchPath, const Path & storeDir); - Value * addConstant(const std::string & name, const Value & v, Constant info); + void addConstant(const std::string & name, const Value & v, Constant info); - void addConstant(const std::string & name, Value * v, Constant info); - - Value * addPrimOp(PrimOpDetails && primOp); + void addPrimOp(PrimOpDetails && primOp); Value prepareNixPath(const SearchPath & searchPath);