summaryrefslogtreecommitdiff
path: root/AK
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-02-09 11:47:24 +0100
committerAndreas Kling <kling@serenityos.org>2020-02-09 14:15:55 +0100
commit80b1af2352270697cf8f84d14bb88c2e84e32801 (patch)
tree357669bcbdd03e066de197207d2134aa64a84f16 /AK
parent3a7e49fe0760552338f2c644d72b467f10f840bc (diff)
downloadserenity-80b1af2352270697cf8f84d14bb88c2e84e32801.zip
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.
Diffstat (limited to 'AK')
-rw-r--r--AK/StringBuilder.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/AK/StringBuilder.cpp b/AK/StringBuilder.cpp
index 619450fcb8..e60f1c8826 100644
--- a/AK/StringBuilder.cpp
+++ b/AK/StringBuilder.cpp
@@ -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