diff options
author | sin-ack <sin-ack@users.noreply.github.com> | 2022-07-11 20:42:03 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-07-12 23:11:35 +0200 |
commit | 60f6bc902b1c13b6eaa8f27b4a99cd40af6bf5cf (patch) | |
tree | 26ec0ce031f335bcc93a92135dbd02c21687c37e /Userland/Utilities/env.cpp | |
parent | fded8f861d7576ceffc818c43bdd62285b569ad0 (diff) | |
download | serenity-60f6bc902b1c13b6eaa8f27b4a99cd40af6bf5cf.zip |
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.
Diffstat (limited to 'Userland/Utilities/env.cpp')
-rw-r--r-- | Userland/Utilities/env.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Utilities/env.cpp b/Userland/Utilities/env.cpp index 01d693f2a5..103b9c59c3 100644 --- a/Userland/Utilities/env.cpp +++ b/Userland/Utilities/env.cpp @@ -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); } } |