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

@ -24,7 +24,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
Config::pledge_domain("TextEditor");
char const* preview_mode = "auto";
auto preview_mode = "auto"sv;
char const* file_to_edit = nullptr;
Core::ArgsParser parser;
parser.add_option(preview_mode, "Preview mode, one of 'none', 'html', 'markdown', 'auto'", "preview-mode", '\0', "mode");
@ -37,9 +37,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(Core::System::unveil("/tmp/portal/filesystemaccess", "rw"));
TRY(Core::System::unveil(nullptr, nullptr));
StringView preview_mode_view = preview_mode;
auto app_icon = GUI::Icon::default_icon("app-text-editor");
auto app_icon = GUI::Icon::default_icon("app-text-editor"sv);
auto window = TRY(GUI::Window::try_create());
window->resize(640, 400);
@ -54,13 +52,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
return GUI::Window::CloseRequestDecision::StayOpen;
};
if (preview_mode_view == "auto") {
if (preview_mode == "auto") {
text_widget->set_auto_detect_preview_mode(true);
} else if (preview_mode_view == "markdown") {
} else if (preview_mode == "markdown") {
text_widget->set_preview_mode(MainWidget::PreviewMode::Markdown);
} else if (preview_mode_view == "html") {
} else if (preview_mode == "html") {
text_widget->set_preview_mode(MainWidget::PreviewMode::HTML);
} else if (preview_mode_view == "none") {
} else if (preview_mode == "none") {
text_widget->set_preview_mode(MainWidget::PreviewMode::None);
} else {
warnln("Invalid mode '{}'", preview_mode);