aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/primops.cc
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-03-04 05:57:04 +0100
committereldritch horrors <pennae@lix.systems>2024-03-04 05:57:04 +0100
commit439f88b7d7596ccd4d1130b5c3e65f6e2ad9658a (patch)
tree822ecc0362c79cb4c6e15332f369a076cd4b4458 /src/libexpr/primops.cc
parent3f3badffc908a61a522b13bb6783442082d6d8d9 (diff)
Merge pull request #9399 from edolstra/revert-vlas
Revert use of boost::container::small_vector in the evaluator (cherry picked from commit 6832d18ac734f4b855f97c07b158491dd01cefcd) Change-Id: I7f10af0c8b8a8beb4b1e36424120995f4ed82738
Diffstat (limited to 'src/libexpr/primops.cc')
-rw-r--r--src/libexpr/primops.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index 9cd9fa6f1..ac8dbeaf1 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -2726,7 +2726,7 @@ static void prim_catAttrs(EvalState & state, const PosIdx pos, Value * * args, V
auto attrName = state.symbols.create(state.forceStringNoCtx(*args[0], pos, "while evaluating the first argument passed to builtins.catAttrs"));
state.forceList(*args[1], pos, "while evaluating the second argument passed to builtins.catAttrs");
- boost::container::small_vector<Value *, nonRecursiveStackReservation> res(args[1]->listSize());
+ Value * res[args[1]->listSize()];
size_t found = 0;
for (auto v2 : args[1]->listItems()) {
@@ -3061,7 +3061,8 @@ static void prim_filter(EvalState & state, const PosIdx pos, Value * * args, Val
state.forceFunction(*args[0], pos, "while evaluating the first argument passed to builtins.filter");
- boost::container::small_vector<Value *, nonRecursiveStackReservation> vs(args[1]->listSize());
+ // FIXME: putting this on the stack is risky.
+ Value * vs[args[1]->listSize()];
size_t k = 0;
bool same = true;
@@ -3450,7 +3451,7 @@ static void prim_concatMap(EvalState & state, const PosIdx pos, Value * * args,
state.forceList(*args[1], pos, "while evaluating the second argument passed to builtins.concatMap");
auto nrLists = args[1]->listSize();
- boost::container::small_vector<Value, conservativeStackReservation> lists(nrLists);
+ Value lists[nrLists];
size_t len = 0;
for (unsigned int n = 0; n < nrLists; ++n) {