mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 18:18:12 +00:00
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:
parent
3a7e49fe07
commit
80b1af2352
1 changed files with 1 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue