1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 06:57:45 +00:00

Userland: Prefer _string over _short_string

As `_string` can't fail anymore (since 3434412), there are no real
benefits to use the short variant in most cases.
This commit is contained in:
Lucas CHOLLET 2023-08-07 22:26:17 -04:00 committed by Andreas Kling
parent a5edc9cdfc
commit 3f35ffb648
198 changed files with 684 additions and 684 deletions

View file

@ -191,7 +191,7 @@ RecursionDecision MarkdownLinkage::visit(Markdown::Text::LinkNode const& link_no
return RecursionDecision::Recurse;
}
if (url.scheme() == "help") {
if (url.host() != "man"_short_string) {
if (url.host() != "man"_string) {
warnln("help:// URL without 'man': {}", href);
m_has_invalid_link = true;
return RecursionDecision::Recurse;

View file

@ -80,7 +80,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
final_target_directory = TRY(String::from_utf8(resolved_path.dirname()));
final_file_template = TRY(String::from_utf8(resolved_path.basename()));
} else {
final_target_directory = "/tmp"_short_string;
final_target_directory = "/tmp"_string;
auto const* env_directory = getenv("TMPDIR");
if (env_directory != nullptr && *env_directory != 0)
final_target_directory = TRY(String::from_utf8({ env_directory, strlen(env_directory) }));

View file

@ -138,7 +138,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto get_formatted_user = [&](i32 uid) -> ErrorOr<String> {
if (uid == -1)
return "-"_short_string;
return "-"_string;
return String::number(uid);
};

View file

@ -93,10 +93,10 @@ static ErrorOr<String> column_to_string(ColumnId column_id, Core::ProcessStatist
case ColumnId::SessionId:
return String::number(process.sid);
case ColumnId::TTY:
return process.tty == "" ? "n/a"_short_string : String::from_deprecated_string(process.tty);
return process.tty == "" ? "n/a"_string : String::from_deprecated_string(process.tty);
case ColumnId::State:
return process.threads.is_empty()
? "Zombie"_short_string
? "Zombie"_string
: String::from_deprecated_string(process.threads.first().state);
case ColumnId::Command:
return String::from_deprecated_string(process.name);
@ -141,7 +141,7 @@ static ErrorOr<String> determine_tty_pseudo_name()
{
auto tty_stat = TRY(Core::System::fstat(STDIN_FILENO));
auto maybe_tty_pseudo_name = TRY(tty_stat_to_pseudo_name(tty_stat));
return maybe_tty_pseudo_name.value_or("n/a"_short_string);
return maybe_tty_pseudo_name.value_or("n/a"_string);
}
static ErrorOr<String> parse_tty_pseudo_name(StringView tty_name)

View file

@ -955,10 +955,10 @@ ErrorOr<int> serenity_main(Main::Arguments args)
HashMap<String, String> paths_to_unveil;
for (auto const& input_filename : TRY(script.input_filenames())) {
TRY(paths_to_unveil.try_set(TRY(FileSystem::absolute_path(input_filename)), edit_in_place ? "rwc"_short_string : "r"_short_string));
TRY(paths_to_unveil.try_set(TRY(FileSystem::absolute_path(input_filename)), edit_in_place ? "rwc"_string : "r"_string));
}
for (auto const& output_filename : TRY(script.output_filenames())) {
TRY(paths_to_unveil.try_set(TRY(FileSystem::absolute_path(output_filename)), "w"_short_string));
TRY(paths_to_unveil.try_set(TRY(FileSystem::absolute_path(output_filename)), "w"_string));
}
Vector<File> inputs;
@ -966,7 +966,7 @@ ErrorOr<int> serenity_main(Main::Arguments args)
if (filename == "-"sv) {
inputs.empend(TRY(File::create_from_stdin()));
} else {
TRY(paths_to_unveil.try_set(TRY(FileSystem::absolute_path(filename)), edit_in_place ? "rwc"_short_string : "r"_short_string));
TRY(paths_to_unveil.try_set(TRY(FileSystem::absolute_path(filename)), edit_in_place ? "rwc"_string : "r"_string));
auto file = TRY(Core::File::open(filename, Core::File::OpenMode::Read));
if (edit_in_place)
inputs.empend(TRY(File::create_with_output_file(LexicalPath { filename }, move(file))));

View file

@ -87,8 +87,8 @@ ErrorOr<int> serenity_main(Main::Arguments args)
return {};
StringBuilder builder;
String idle_string = "n/a"_short_string;
String what = "n/a"_short_string;
String idle_string = "n/a"_string;
String what = "n/a"_string;
StringView tty_display_name = tty;
auto maybe_stat = Core::System::stat(tty);
if (!maybe_stat.is_error()) {