mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-02 09:18:52 +00:00
Everywhere: Add sv suffix to strings relying on StringView(char const*)
Each of these strings would previously rely on StringView's char const* constructor overload, which would call __builtin_strlen on the string. Since we now have operator ""sv, we can replace these with much simpler versions. This opens the door to being able to remove StringView(char const*). No functional changes.
This commit is contained in:
parent
e5f09ea170
commit
3f3f45580a
Notes:
sideshowbarker
2024-07-17 09:27:05 +09:00
Author: https://github.com/sin-ack
Commit: 3f3f45580a
Pull-request: https://github.com/SerenityOS/serenity/pull/14555
Reviewed-by: https://github.com/Dexesttp ✅
Reviewed-by: https://github.com/kleinesfilmroellchen
762 changed files with 8315 additions and 8316 deletions
|
@ -407,22 +407,22 @@ _StartOfFunction:
|
|||
BEGIN_STATE(MarkupDeclarationOpen)
|
||||
{
|
||||
DONT_CONSUME_NEXT_INPUT_CHARACTER;
|
||||
if (consume_next_if_match("--")) {
|
||||
if (consume_next_if_match("--"sv)) {
|
||||
create_new_token(HTMLToken::Type::Comment);
|
||||
m_current_token.set_start_position({}, nth_last_position(3));
|
||||
SWITCH_TO(CommentStart);
|
||||
}
|
||||
if (consume_next_if_match("DOCTYPE", CaseSensitivity::CaseInsensitive)) {
|
||||
if (consume_next_if_match("DOCTYPE"sv, CaseSensitivity::CaseInsensitive)) {
|
||||
SWITCH_TO(DOCTYPE);
|
||||
}
|
||||
if (consume_next_if_match("[CDATA[")) {
|
||||
if (consume_next_if_match("[CDATA["sv)) {
|
||||
// We keep the parser optional so that syntax highlighting can be lexer-only.
|
||||
// The parser registers itself with the lexer it creates.
|
||||
if (m_parser != nullptr && m_parser->adjusted_current_node().namespace_() != Namespace::HTML) {
|
||||
SWITCH_TO(CDATASection);
|
||||
} else {
|
||||
create_new_token(HTMLToken::Type::Comment);
|
||||
m_current_builder.append("[CDATA[");
|
||||
m_current_builder.append("[CDATA["sv);
|
||||
SWITCH_TO_WITH_UNCLEAN_BUILDER(BogusComment);
|
||||
}
|
||||
}
|
||||
|
@ -595,10 +595,10 @@ _StartOfFunction:
|
|||
}
|
||||
ANYTHING_ELSE
|
||||
{
|
||||
if (to_ascii_uppercase(current_input_character.value()) == 'P' && consume_next_if_match("UBLIC", CaseSensitivity::CaseInsensitive)) {
|
||||
if (to_ascii_uppercase(current_input_character.value()) == 'P' && consume_next_if_match("UBLIC"sv, CaseSensitivity::CaseInsensitive)) {
|
||||
SWITCH_TO(AfterDOCTYPEPublicKeyword);
|
||||
}
|
||||
if (to_ascii_uppercase(current_input_character.value()) == 'S' && consume_next_if_match("YSTEM", CaseSensitivity::CaseInsensitive)) {
|
||||
if (to_ascii_uppercase(current_input_character.value()) == 'S' && consume_next_if_match("YSTEM"sv, CaseSensitivity::CaseInsensitive)) {
|
||||
SWITCH_TO(AfterDOCTYPESystemKeyword);
|
||||
}
|
||||
log_parse_error();
|
||||
|
@ -1487,7 +1487,7 @@ _StartOfFunction:
|
|||
}
|
||||
ANYTHING_ELSE
|
||||
{
|
||||
m_current_builder.append("--");
|
||||
m_current_builder.append("--"sv);
|
||||
RECONSUME_IN(Comment);
|
||||
}
|
||||
}
|
||||
|
@ -1498,7 +1498,7 @@ _StartOfFunction:
|
|||
{
|
||||
ON('-')
|
||||
{
|
||||
m_current_builder.append("--!");
|
||||
m_current_builder.append("--!"sv);
|
||||
SWITCH_TO_WITH_UNCLEAN_BUILDER(CommentEndDash);
|
||||
}
|
||||
ON('>')
|
||||
|
@ -1515,7 +1515,7 @@ _StartOfFunction:
|
|||
}
|
||||
ANYTHING_ELSE
|
||||
{
|
||||
m_current_builder.append("--!");
|
||||
m_current_builder.append("--!"sv);
|
||||
RECONSUME_IN(Comment);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue