mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 14:47:35 +00:00
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.
This commit is contained in:
parent
89dceb178b
commit
35a97884aa
2 changed files with 43 additions and 42 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue