AK: Some FlyString improvements

We're now clever enough to notice when we're constructing a FlyString
from a String that is actually already a FlyString. :^)
This commit is contained in:
Andreas Kling 2020-05-05 10:08:14 +02:00
commit e4b9cf9b6c
Notes: sideshowbarker 2024-07-19 06:57:32 +09:00
2 changed files with 24 additions and 0 deletions

View file

@ -63,6 +63,10 @@ FlyString::FlyString(const String& string)
{
if (string.is_null())
return;
if (string.impl()->is_fly()) {
m_impl = string.impl();
return;
}
auto it = fly_impls().find(const_cast<StringImpl*>(string.impl()));
if (it == fly_impls().end()) {
fly_impls().set(const_cast<StringImpl*>(string.impl()));