mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 00:50:22 +00:00
AK: Add fast path for constructing StringImpl from "" literal
This commit is contained in:
parent
518b8fb292
commit
b2f15537bb
Notes:
sideshowbarker
2024-07-18 01:53:39 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/b2f15537bb0
1 changed files with 3 additions and 0 deletions
|
@ -78,6 +78,9 @@ RefPtr<StringImpl> StringImpl::create(const char* cstring, ShouldChomp shouldCho
|
|||
if (!cstring)
|
||||
return nullptr;
|
||||
|
||||
if (!*cstring)
|
||||
return the_empty_stringimpl();
|
||||
|
||||
return create(cstring, strlen(cstring), shouldChomp);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue