1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:17:45 +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:
sin-ack 2022-07-11 17:32:29 +00:00 committed by Andreas Kling
parent e5f09ea170
commit 3f3f45580a
762 changed files with 8315 additions and 8316 deletions

View file

@ -50,7 +50,7 @@ void WebContentConsoleClient::handle_input(String const& js_source)
StringBuilder output_html;
if (result.is_abrupt()) {
output_html.append("Uncaught exception: ");
output_html.append("Uncaught exception: "sv);
auto error = *result.release_error().value();
if (error.is_object())
output_html.append(JS::MarkupGenerator::html_from_error(error.as_object()));
@ -111,19 +111,19 @@ void WebContentConsoleClient::send_messages(i32 start_index)
auto& message = m_message_log[i];
switch (message.type) {
case ConsoleOutput::Type::HTML:
message_types.append("html");
message_types.append("html"sv);
break;
case ConsoleOutput::Type::Clear:
message_types.append("clear");
message_types.append("clear"sv);
break;
case ConsoleOutput::Type::BeginGroup:
message_types.append("group");
message_types.append("group"sv);
break;
case ConsoleOutput::Type::BeginGroupCollapsed:
message_types.append("groupCollapsed");
message_types.append("groupCollapsed"sv);
break;
case ConsoleOutput::Type::EndGroup:
message_types.append("groupEnd");
message_types.append("groupEnd"sv);
break;
}
@ -147,10 +147,10 @@ JS::ThrowCompletionOr<JS::Value> WebContentConsoleClient::printer(JS::Console::L
if (!trace.label.is_empty())
html.appendff("<span class='title'>{}</span><br>", escape_html_entities(trace.label));
html.append("<span class='trace'>");
html.append("<span class='trace'>"sv);
for (auto& function_name : trace.stack)
html.appendff("-> {}<br>", escape_html_entities(function_name));
html.append("</span>");
html.append("</span>"sv);
print_html(html.string_view());
return JS::js_undefined();
@ -162,34 +162,34 @@ JS::ThrowCompletionOr<JS::Value> WebContentConsoleClient::printer(JS::Console::L
return JS::js_undefined();
}
auto output = String::join(" ", arguments.get<JS::MarkedVector<JS::Value>>());
auto output = String::join(' ', arguments.get<JS::MarkedVector<JS::Value>>());
m_console.output_debug_message(log_level, output);
StringBuilder html;
switch (log_level) {
case JS::Console::LogLevel::Debug:
html.append("<span class=\"debug\">(d) ");
html.append("<span class=\"debug\">(d) "sv);
break;
case JS::Console::LogLevel::Error:
html.append("<span class=\"error\">(e) ");
html.append("<span class=\"error\">(e) "sv);
break;
case JS::Console::LogLevel::Info:
html.append("<span class=\"info\">(i) ");
html.append("<span class=\"info\">(i) "sv);
break;
case JS::Console::LogLevel::Log:
html.append("<span class=\"log\"> ");
html.append("<span class=\"log\"> "sv);
break;
case JS::Console::LogLevel::Warn:
case JS::Console::LogLevel::CountReset:
html.append("<span class=\"warn\">(w) ");
html.append("<span class=\"warn\">(w) "sv);
break;
default:
html.append("<span>");
html.append("<span>"sv);
break;
}
html.append(escape_html_entities(output));
html.append("</span>");
html.append("</span>"sv);
print_html(html.string_view());
return JS::js_undefined();
}