mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
AK: Forward substring creation with shared superstring to StringBase
This commit is contained in:
parent
5d6cd65e29
commit
e7700e16ee
Notes:
sideshowbarker
2024-07-17 04:09:56 +09:00
Author: https://github.com/DanShaders
Commit: e7700e16ee
Pull-request: https://github.com/SerenityOS/serenity/pull/21661
Reviewed-by: https://github.com/ADKaster
Reviewed-by: https://github.com/alimpfard
Reviewed-by: https://github.com/kleinesfilmroellchen
Reviewed-by: https://github.com/trflynn89
5 changed files with 34 additions and 5 deletions
|
@ -252,11 +252,7 @@ ErrorOr<String> String::substring_from_byte_offset(size_t start) const
|
|||
|
||||
ErrorOr<String> String::substring_from_byte_offset_with_shared_superstring(size_t start, size_t byte_count) const
|
||||
{
|
||||
if (!byte_count)
|
||||
return String {};
|
||||
if (byte_count <= MAX_SHORT_STRING_BYTE_COUNT)
|
||||
return String::from_utf8(bytes_as_string_view().substring_view(start, byte_count));
|
||||
return String { TRY(Detail::StringData::create_substring(*m_data, start, byte_count)) };
|
||||
return String { TRY(StringBase::substring_from_byte_offset_with_shared_superstring(start, byte_count)) };
|
||||
}
|
||||
|
||||
ErrorOr<String> String::substring_from_byte_offset_with_shared_superstring(size_t start) const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue