mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00: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: https://github.com/LadybirdBrowser/ladybird/commit/1e8cc97b731 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)
|
||||
{
|
||||
if (Utf8View(view).validate())
|
||||
return String::from_utf8_without_validation(view.bytes());
|
||||
|
||||
StringBuilder builder;
|
||||
|
||||
for (auto c : Utf8View { view })
|
||||
|
|
Loading…
Reference in a new issue