diff options
author | Brian Gianforcaro <bgianf@serenityos.org> | 2021-08-14 23:49:17 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-08-18 10:21:19 +0200 |
commit | e9d8f158a12c9dbec629b12939a23c29c3c53aa2 (patch) | |
tree | 598ed3d99be7d41b47a69e1f02847dd501cbe105 /Kernel/CommandLine.cpp | |
parent | 9bdb44c5d26d8f702264c47a82c75fbb368a7ffc (diff) | |
download | serenity-e9d8f158a12c9dbec629b12939a23c29c3c53aa2.zip |
AK+Kernel: StringView hash map Traits should not set peek type to String
This typo / bug in the Traits<T> implementation for StringView caused
AK::HashMap methods to return a `String` when looking up values out of
a hash map of type HashTable<StringView,StringView>.
This change fixes the typo, and fixes the only consumer, the kernel
Commandline class.
Diffstat (limited to 'Kernel/CommandLine.cpp')
-rw-r--r-- | Kernel/CommandLine.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Kernel/CommandLine.cpp b/Kernel/CommandLine.cpp index 237abec349..5eed0bd8b0 100644 --- a/Kernel/CommandLine.cpp +++ b/Kernel/CommandLine.cpp @@ -80,7 +80,7 @@ UNMAP_AFTER_INIT CommandLine::CommandLine(const String& cmdline_from_bootloader) add_arguments(args); } -Optional<String> CommandLine::lookup(const StringView& key) const +Optional<StringView> CommandLine::lookup(const StringView& key) const { return m_params.get(key); } @@ -132,7 +132,7 @@ UNMAP_AFTER_INIT bool CommandLine::is_force_pio() const return contains("force_pio"sv); } -UNMAP_AFTER_INIT String CommandLine::root_device() const +UNMAP_AFTER_INIT StringView CommandLine::root_device() const { return lookup("root"sv).value_or("/dev/hda"sv); } @@ -220,14 +220,14 @@ UNMAP_AFTER_INIT bool CommandLine::is_no_framebuffer_devices_mode() const return mode == BootMode::NoFramebufferDevices || mode == BootMode::SelfTest; } -String CommandLine::userspace_init() const +StringView CommandLine::userspace_init() const { return lookup("init"sv).value_or("/bin/SystemServer"sv); } Vector<String> CommandLine::userspace_init_args() const { - auto init_args = lookup("init_args"sv).value_or(""sv).split(','); + auto init_args = lookup("init_args"sv).value_or(""sv).to_string().split(';'); if (!init_args.is_empty()) init_args.prepend(userspace_init()); |