aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpennae <github@quasiparticle.net>2022-01-02 00:30:57 +0100
committerpennae <github@quasiparticle.net>2022-01-13 14:00:20 +0100
commit6401e443a441f58f48e2cbab5286b89ec162835a (patch)
tree6120e3ec203dab6a38ae0598e2250c990ec1401b /src
parentef45787aae1c91dffce1e95db3d46740b0165319 (diff)
move strings in derivationStrict
the temporary will be discarded anyway, so we can move out of it and save many small allocations and copies.
Diffstat (limited to 'src')
-rw-r--r--src/libexpr/primops.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index 365595c92..003e588a4 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -1079,10 +1079,10 @@ static void prim_derivationStrict(EvalState & state, const Pos & pos, Value * *
} else {
auto s = state.coerceToString(*i->pos, *i->value, context, true);
drv.env.emplace(key, s);
- if (i->name == state.sBuilder) drv.builder = s;
- else if (i->name == state.sSystem) drv.platform = s;
- else if (i->name == state.sOutputHash) outputHash = s;
- else if (i->name == state.sOutputHashAlgo) outputHashAlgo = s;
+ if (i->name == state.sBuilder) drv.builder = std::move(s);
+ else if (i->name == state.sSystem) drv.platform = std::move(s);
+ else if (i->name == state.sOutputHash) outputHash = std::move(s);
+ else if (i->name == state.sOutputHashAlgo) outputHashAlgo = std::move(s);
else if (i->name == state.sOutputHashMode) handleHashMode(s);
else if (i->name == state.sOutputs)
handleOutputs(tokenizeString<Strings>(s));