mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibJS: Avoid unnecessary StringImpl copy in StringOrSymbol(String)
This commit is contained in:
parent
5de5af60c1
commit
cfd141b4f9
Notes:
sideshowbarker
2024-07-19 02:03:48 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/cfd141b4f9d
1 changed files with 3 additions and 1 deletions
|
@ -51,8 +51,10 @@ public:
|
|||
}
|
||||
|
||||
StringOrSymbol(const String& string)
|
||||
: m_ptr(StringImpl::create(string.characters(), string.length()).leak_ref())
|
||||
: m_ptr(string.impl())
|
||||
{
|
||||
ASSERT(!string.is_null());
|
||||
static_cast<const StringImpl*>(m_ptr)->ref();
|
||||
}
|
||||
|
||||
~StringOrSymbol()
|
||||
|
|
Loading…
Reference in a new issue