1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 17:55:08 +00:00

LibTextCodec: Don't allocate Strings on encoding normalisation

This ripples down to LibWeb's HTML and XHR decoders, which therefore
become less allocation heavy.
This commit is contained in:
Hendiadyoin1 2022-03-21 00:09:28 +01:00 committed by Andreas Kling
parent 820e03e8d4
commit 6a95df2526
6 changed files with 48 additions and 48 deletions

View file

@ -34,7 +34,7 @@ bool prescan_skip_whitespace_and_slashes(const ByteBuffer& input, size_t& positi
}
// https://html.spec.whatwg.org/multipage/urls-and-fetching.html#algorithm-for-extracting-a-character-encoding-from-a-meta-element
Optional<String> extract_character_encoding_from_meta_element(String const& string)
Optional<StringView> extract_character_encoding_from_meta_element(String const& string)
{
// Checking for "charset" is case insensitive, as is getting an encoding.
// Therefore, stick to lowercase from the start for simplicity.