1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 05:24:58 +00:00

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
parent 2a29e668bd
commit e4b9cf9b6c
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()));