1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:57:44 +00:00

Preallocate the maximum number of FileHandle pointers (fds) in every process.

This could even use a more specific data structure since it doesn't need the
grow/shrink capabilities of a vector.
This commit is contained in:
Andreas Kling 2018-11-01 13:39:28 +01:00
parent fce81d376c
commit 065f0aee35
4 changed files with 37 additions and 18 deletions

View file

@ -172,6 +172,17 @@ public:
m_impl = newImpl;
}
void resize(size_t new_size)
{
ASSERT(new_size >= size());
if (!new_size)
return;
ensureCapacity(new_size);
for (size_t i = size(); i < new_size; ++i)
new (m_impl->slot(i)) T;
m_impl->m_size = new_size;
}
class Iterator {
public:
bool operator!=(const Iterator& other) { return m_index != other.m_index; }