mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-06 16:09:30 +00:00
AK: Reduce String's allocated data by one byte
This was copied from allocation_size_for_stringimpl, which had to ensure the string is null-terminated. String makes no such guarantee.
This commit is contained in:
parent
c111536f28
commit
ef275e25b8
|
@ -109,7 +109,7 @@ StringData::~StringData()
|
||||||
|
|
||||||
constexpr size_t allocation_size_for_string_data(size_t length)
|
constexpr size_t allocation_size_for_string_data(size_t length)
|
||||||
{
|
{
|
||||||
return sizeof(StringData) + (sizeof(char) * length) + sizeof(char);
|
return sizeof(StringData) + (sizeof(char) * length);
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<NonnullRefPtr<StringData>> StringData::create_uninitialized(size_t byte_count, u8*& buffer)
|
ErrorOr<NonnullRefPtr<StringData>> StringData::create_uninitialized(size_t byte_count, u8*& buffer)
|
||||||
|
|
Loading…
Reference in a new issue