1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:04:59 +00:00

Userland: Convert command line arguments to String/StringView

StringView was used where possible. Some utilities still use libc
functions which expect null-terminated strings, so String objects were
used there instead.
This commit is contained in:
sin-ack 2022-07-11 20:42:03 +00:00 committed by Andreas Kling
parent fded8f861d
commit 60f6bc902b
25 changed files with 101 additions and 100 deletions

View file

@ -16,7 +16,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(Core::System::pledge("stdio rpath exec"));
bool ignore_env = false;
char const* split_string = nullptr;
StringView split_string {};
Vector<String> values;
Core::ArgsParser args_parser;
@ -41,8 +41,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
}
Vector<StringView> new_argv;
if (split_string) {
for (auto view : StringView(split_string).split_view(' ')) {
if (!split_string.is_empty()) {
for (auto view : split_string.split_view(' ')) {
new_argv.append(view);
}
}