mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 13:35:07 +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
762 changed files with 8315 additions and 8316 deletions
|
@ -14,54 +14,54 @@ String HTMLToken::to_string() const
|
|||
|
||||
switch (type()) {
|
||||
case HTMLToken::Type::DOCTYPE:
|
||||
builder.append("DOCTYPE");
|
||||
builder.append(" { name: '");
|
||||
builder.append("DOCTYPE"sv);
|
||||
builder.append(" { name: '"sv);
|
||||
builder.append(doctype_data().name);
|
||||
builder.append("' }");
|
||||
builder.append("' }"sv);
|
||||
break;
|
||||
case HTMLToken::Type::StartTag:
|
||||
builder.append("StartTag");
|
||||
builder.append("StartTag"sv);
|
||||
break;
|
||||
case HTMLToken::Type::EndTag:
|
||||
builder.append("EndTag");
|
||||
builder.append("EndTag"sv);
|
||||
break;
|
||||
case HTMLToken::Type::Comment:
|
||||
builder.append("Comment");
|
||||
builder.append("Comment"sv);
|
||||
break;
|
||||
case HTMLToken::Type::Character:
|
||||
builder.append("Character");
|
||||
builder.append("Character"sv);
|
||||
break;
|
||||
case HTMLToken::Type::EndOfFile:
|
||||
builder.append("EndOfFile");
|
||||
builder.append("EndOfFile"sv);
|
||||
break;
|
||||
case HTMLToken::Type::Invalid:
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
if (type() == HTMLToken::Type::StartTag || type() == HTMLToken::Type::EndTag) {
|
||||
builder.append(" { name: '");
|
||||
builder.append(" { name: '"sv);
|
||||
builder.append(tag_name());
|
||||
builder.append("', { ");
|
||||
builder.append("', { "sv);
|
||||
for_each_attribute([&](auto& attribute) {
|
||||
builder.append(attribute.local_name);
|
||||
builder.append("=\"");
|
||||
builder.append("=\""sv);
|
||||
builder.append(attribute.value);
|
||||
builder.append("\" ");
|
||||
builder.append("\" "sv);
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
builder.append("} }");
|
||||
builder.append("} }"sv);
|
||||
}
|
||||
|
||||
if (is_comment()) {
|
||||
builder.append(" { data: '");
|
||||
builder.append(" { data: '"sv);
|
||||
builder.append(comment());
|
||||
builder.append("' }");
|
||||
builder.append("' }"sv);
|
||||
}
|
||||
|
||||
if (is_character()) {
|
||||
builder.append(" { data: '");
|
||||
builder.append(" { data: '"sv);
|
||||
builder.append_code_point(code_point());
|
||||
builder.append("' }");
|
||||
builder.append("' }"sv);
|
||||
}
|
||||
|
||||
if (type() == HTMLToken::Type::Character) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue