mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-17 16:28:06 +03: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
Notes:
sideshowbarker
2024-07-19 09:31:06 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/80b1af23522
@ -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…
Reference in New Issue
Block a user