1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-09 09:34:57 +09:00

AK: Remove the m_length member for StringBuilder

Instead we can just use ByteBuffer::size() which already keeps track
of the buffer's size.
This commit is contained in:
Gunnar Beutner 2021-05-31 00:58:07 +02:00 committed by Ali Mohammad Pur
parent 4c32a128ef
commit de0aa44bb6
Notes: sideshowbarker 2024-07-18 17:08:04 +09:00
2 changed files with 5 additions and 9 deletions

View file

@ -44,9 +44,9 @@ public:
[[nodiscard]] StringView string_view() const;
void clear();
[[nodiscard]] size_t length() const { return m_length; }
[[nodiscard]] bool is_empty() const { return m_length == 0; }
void trim(size_t count) { m_length -= count; }
[[nodiscard]] size_t length() const { return m_buffer.size(); }
[[nodiscard]] bool is_empty() const { return m_buffer.is_empty(); }
void trim(size_t count) { m_buffer.resize(m_buffer.size() - count); }
template<class SeparatorType, class CollectionType>
void join(const SeparatorType& separator, const CollectionType& collection)
@ -68,7 +68,6 @@ private:
static constexpr size_t inline_capacity = 128;
AK::Detail::ByteBuffer<inline_capacity> m_buffer;
size_t m_length { 0 };
};
}