1
0
mirror of https://github.com/SerenityOS/serenity synced 2024-07-09 09:57:28 +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:
Timothy Flynn 2023-01-22 15:04:35 -05:00 committed by Linus Groh
parent c111536f28
commit ef275e25b8

View File

@ -109,7 +109,7 @@ StringData::~StringData()
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)