mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
AK: Don't use realloc() in AK::ByteBuffer
This class is the only reason we have to support krealloc() in the kernel heap, something which adds a lot of complexity. Let's move towards a simpler path and do malloc+memset in the ByteBuffer code (where we know the sizes anyway.)
This commit is contained in:
@@ -242,7 +242,9 @@ private:
|
||||
u8* new_buffer;
|
||||
new_capacity = kmalloc_good_size(new_capacity);
|
||||
if (!m_inline) {
|
||||
new_buffer = (u8*)krealloc(m_outline_buffer, new_capacity);
|
||||
new_buffer = (u8*)kmalloc(new_capacity);
|
||||
if (m_outline_buffer)
|
||||
__builtin_memcpy(new_buffer, m_outline_buffer, min(new_capacity, m_outline_capacity));
|
||||
VERIFY(new_buffer);
|
||||
} else {
|
||||
new_buffer = (u8*)kmalloc(new_capacity);
|
||||
|
||||
Reference in New Issue
Block a user