mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-09 17:44:56 +09:00
AK: Add fast-path in from_utf8_with_replacement_character for utf-8
This ports the same optimization which was made in
1a46d8df5f
to this function as well.
This commit is contained in:
parent
c68b8b5bda
commit
1e8cc97b73
Notes:
github-actions[bot]
2024-08-12 10:40:01 +00:00
Author: https://github.com/shannonbooth
Commit: 1e8cc97b73
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1038
Reviewed-by: https://github.com/trflynn89
1 changed files with 3 additions and 0 deletions
|
@ -22,6 +22,9 @@ namespace AK {
|
||||||
|
|
||||||
String String::from_utf8_with_replacement_character(StringView view)
|
String String::from_utf8_with_replacement_character(StringView view)
|
||||||
{
|
{
|
||||||
|
if (Utf8View(view).validate())
|
||||||
|
return String::from_utf8_without_validation(view.bytes());
|
||||||
|
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
|
|
||||||
for (auto c : Utf8View { view })
|
for (auto c : Utf8View { view })
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue