1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:04:59 +00:00

AK: Use kmalloc_array() where appropriate

This commit is contained in:
Andreas Kling 2021-08-07 22:34:29 +02:00
parent 2189524cb3
commit 3609ac4cf9
2 changed files with 3 additions and 3 deletions

View file

@ -20,7 +20,7 @@ public:
: m_size(size)
{
if (m_size != 0) {
m_elements = (T*)kmalloc(sizeof(T) * m_size);
m_elements = static_cast<T*>(kmalloc_array(m_size, sizeof(T)));
for (size_t i = 0; i < m_size; ++i)
new (&m_elements[i]) T();
}
@ -34,7 +34,7 @@ public:
: m_size(other.m_size)
{
if (m_size != 0) {
m_elements = (T*)kmalloc(sizeof(T) * m_size);
m_elements = static_cast<T*>(kmalloc_array(m_size, sizeof(T)));
for (size_t i = 0; i < m_size; ++i)
new (&m_elements[i]) T(other[i]);
}