diff options
author | Brian Gianforcaro <bgianf@serenityos.org> | 2021-05-31 01:59:02 -0700 |
---|---|---|
committer | Ali Mohammad Pur <Ali.mpfard@gmail.com> | 2021-05-31 14:04:00 +0430 |
commit | 35a97884aa665b86319dbc1a298553fe2527e033 (patch) | |
tree | a7743cfb920b2dee49973e5a5df5e04d60364732 /Kernel/CommandLine.h | |
parent | 89dceb178b2023ab75515b1f00c7969793f50ace (diff) | |
download | serenity-35a97884aa665b86319dbc1a298553fe2527e033.zip |
Kernel: Move CommandLine API to use AK::StringView instead of AK::String
The current CommandLine API unfortunately allocates Strings just to
query the presence of arguments on the command line. Switch the API
to use StringView instead to reduce the number of String allocations.
Diffstat (limited to 'Kernel/CommandLine.h')
-rw-r--r-- | Kernel/CommandLine.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Kernel/CommandLine.h b/Kernel/CommandLine.h index 8820072386..9a963131d1 100644 --- a/Kernel/CommandLine.h +++ b/Kernel/CommandLine.h @@ -49,8 +49,8 @@ public: static void initialize(); [[nodiscard]] const String& string() const { return m_string; } - Optional<String> lookup(const String& key) const; - [[nodiscard]] bool contains(const String& key) const; + Optional<String> lookup(const StringView& key) const; + [[nodiscard]] bool contains(const StringView& key) const; [[nodiscard]] bool is_boot_profiling_enabled() const; [[nodiscard]] bool is_ide_enabled() const; @@ -76,11 +76,11 @@ public: private: CommandLine(const String&); - void add_arguments(const Vector<String>& args); + void add_arguments(const Vector<StringView>& args); void build_commandline(const String& cmdline_from_bootloader); String m_string; - HashMap<String, String> m_params; + HashMap<StringView, StringView> m_params; }; const CommandLine& kernel_command_line(); |