AK: Make StringBuilder::to_string() non-destructive

This was an artifact of an earlier design of StringBuilder where I had
attempted to preserve the same allocation from build to final String.
This commit is contained in:
Andreas Kling 2020-02-09 11:47:24 +01:00
parent 3a7e49fe07
commit 80b1af2352
Notes: sideshowbarker 2024-07-19 09:31:06 +09:00

View File

@ -93,9 +93,7 @@ ByteBuffer StringBuilder::to_byte_buffer()
String StringBuilder::to_string()
{
auto string = String((const char*)m_buffer.data(), m_length);
clear();
return string;
return String((const char*)m_buffer.data(), m_length);
}
StringView StringBuilder::string_view() const