1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:07:47 +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

@ -73,9 +73,9 @@ static TitleAndText build_backtrace(Coredump::Reader const& coredump, ELF::Core:
};
if (metadata.contains("assertion"))
prepend_metadata("assertion", "ASSERTION FAILED: {}");
prepend_metadata("assertion", "ASSERTION FAILED: {}"sv);
else if (metadata.contains("pledge_violation"))
prepend_metadata("pledge_violation", "Has not pledged {}");
prepend_metadata("pledge_violation", "Has not pledged {}"sv);
auto fault_address = metadata.get("fault_address");
auto fault_type = metadata.get("fault_type");
@ -168,7 +168,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto pid = coredump->process_pid();
auto termination_signal = coredump->process_termination_signal();
auto app_icon = GUI::Icon::default_icon("app-crash-reporter");
auto app_icon = GUI::Icon::default_icon("app-crash-reporter"sv);
auto window = TRY(GUI::Window::try_create());
window->set_title("Crash Reporter");
@ -263,16 +263,16 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
};
auto& debug_button = *widget->find_descendant_of_type_named<GUI::Button>("debug_button");
debug_button.set_icon(TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-hack-studio.png")));
debug_button.set_icon(TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-hack-studio.png"sv)));
debug_button.on_click = [&](int) {
GUI::Process::spawn_or_show_error(window, "/bin/HackStudio", Array { "-c", coredump_path.characters() });
GUI::Process::spawn_or_show_error(window, "/bin/HackStudio"sv, Array { "-c", coredump_path.characters() });
};
auto& save_backtrace_button = *widget->find_descendant_of_type_named<GUI::Button>("save_backtrace_button");
save_backtrace_button.set_icon(TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/save.png")));
save_backtrace_button.set_icon(TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/save.png"sv)));
save_backtrace_button.on_click = [&](auto) {
if (full_backtrace.is_empty()) {
GUI::MessageBox::show(window, "Backtrace has not been generated yet. Please wait...", "Empty Backtrace", GUI::MessageBox::Type::Error);
GUI::MessageBox::show(window, "Backtrace has not been generated yet. Please wait..."sv, "Empty Backtrace"sv, GUI::MessageBox::Type::Error);
return;
}
@ -283,7 +283,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto file = file_or_error.value();
if (!file->write(full_backtrace.to_string()))
GUI::MessageBox::show(window, String::formatted("Couldn't save file: {}.", file_or_error.error()), "Saving backtrace failed", GUI::MessageBox::Type::Error);
GUI::MessageBox::show(window, String::formatted("Couldn't save file: {}.", file_or_error.error()), "Saving backtrace failed"sv, GUI::MessageBox::Type::Error);
};
(void)Threading::BackgroundAction<ThreadBacktracesAndCpuRegisters>::construct(