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:
parent
4c32a128ef
commit
de0aa44bb6
Notes:
sideshowbarker
2024-07-18 17:08:04 +09:00
Author: https://github.com/gunnarbeutner
Commit: de0aa44bb6
Pull-request: https://github.com/SerenityOS/serenity/pull/7609
Reviewed-by: https://github.com/alimpfard
2 changed files with 5 additions and 9 deletions
|
@ -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 };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue