mirror of
https://github.com/SerenityOS/serenity
synced 2024-07-22 02:26:11 +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:
parent
0718bd264c
commit
966880eb45
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue