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
Notes: sideshowbarker 2024-07-17 01:23:08 +09:00

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)