From fd5ee06bbf4e9872827ffb4324758e8beeb780de Mon Sep 17 00:00:00 2001 From: Ali Mohammad Pur Date: Sat, 12 Oct 2024 22:33:06 +0200 Subject: [PATCH] LibXML: Avoid allocating ByteStrings for AcceptedRule These come from string literals and compiletime-known values, no need to allocate a ByteString. --- Userland/Libraries/LibXML/Parser/Parser.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibXML/Parser/Parser.h b/Userland/Libraries/LibXML/Parser/Parser.h index 4def9782bee..b12bc031559 100644 --- a/Userland/Libraries/LibXML/Parser/Parser.h +++ b/Userland/Libraries/LibXML/Parser/Parser.h @@ -184,7 +184,7 @@ private: { auto error = ParseError { forward(args)... }; if (m_current_rule.accept) { - auto rule_name = m_current_rule.rule.value_or(""); + auto rule_name = m_current_rule.rule.value_or(""sv); if (rule_name.starts_with("parse_"sv)) rule_name = rule_name.substring_view(6); @@ -212,7 +212,7 @@ private: bool m_standalone { false }; HashMap m_processing_instructions; struct AcceptedRule { - Optional rule {}; + Optional rule {}; bool accept { false }; } m_current_rule {};