From 35a97884aa665b86319dbc1a298553fe2527e033 Mon Sep 17 00:00:00 2001 From: Brian Gianforcaro Date: Mon, 31 May 2021 01:59:02 -0700 Subject: 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. --- Kernel/CommandLine.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Kernel/CommandLine.h') 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 lookup(const String& key) const; - [[nodiscard]] bool contains(const String& key) const; + Optional 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& args); + void add_arguments(const Vector& args); void build_commandline(const String& cmdline_from_bootloader); String m_string; - HashMap m_params; + HashMap m_params; }; const CommandLine& kernel_command_line(); -- cgit v1.2.3