Commit 3eae3a28 authored by Max Kellermann's avatar Max Kellermann

queue/Queue: allocate MoveRange() buffer on the heap

No variable-length arrays on the stack.
parent 3c1f7c77
...@@ -150,7 +150,8 @@ Queue::MovePostion(unsigned from, unsigned to) noexcept ...@@ -150,7 +150,8 @@ Queue::MovePostion(unsigned from, unsigned to) noexcept
void void
Queue::MoveRange(unsigned start, unsigned end, unsigned to) noexcept Queue::MoveRange(unsigned start, unsigned end, unsigned to) noexcept
{ {
Item tmp[end - start]; const auto tmp = std::make_unique<Item[]>(end - start);
// Copy the original block [start,end-1] // Copy the original block [start,end-1]
for (unsigned i = start; i < end; i++) for (unsigned i = start; i < end; i++)
tmp[i - start] = items[i]; tmp[i - start] = items[i];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment