From f7139d9422f7b517df4927a9fe1157f6a1aa39ec Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 16 Apr 2021 23:44:06 +0200 Subject: [PATCH] AK: Make LexicalPath take String instead of StringView --- AK/LexicalPath.cpp | 10 +++++----- AK/LexicalPath.h | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/AK/LexicalPath.cpp b/AK/LexicalPath.cpp index 7fbe01482f3..ff43ee75d02 100644 --- a/AK/LexicalPath.cpp +++ b/AK/LexicalPath.cpp @@ -31,8 +31,8 @@ namespace AK { -LexicalPath::LexicalPath(const StringView& s) - : m_string(s) +LexicalPath::LexicalPath(String s) + : m_string(move(s)) { canonicalize(); m_is_valid = true; @@ -114,12 +114,12 @@ bool LexicalPath::has_extension(const StringView& extension) const return m_string.ends_with(extension, CaseSensitivity::CaseInsensitive); } -String LexicalPath::canonicalized_path(const StringView& path) +String LexicalPath::canonicalized_path(String path) { - return LexicalPath(path).string(); + return LexicalPath(move(path)).string(); } -String LexicalPath::relative_path(const String absolute_path, const String& prefix) +String LexicalPath::relative_path(String absolute_path, const String& prefix) { if (!LexicalPath { absolute_path }.is_absolute() || !LexicalPath { prefix }.is_absolute()) return {}; diff --git a/AK/LexicalPath.h b/AK/LexicalPath.h index 1a71418e659..4e25559d522 100644 --- a/AK/LexicalPath.h +++ b/AK/LexicalPath.h @@ -34,7 +34,7 @@ namespace AK { class LexicalPath { public: LexicalPath() = default; - explicit LexicalPath(const StringView&); + explicit LexicalPath(String); bool is_valid() const { return m_is_valid; } bool is_absolute() const { return m_is_absolute; } @@ -49,8 +49,8 @@ public: bool has_extension(const StringView&) const; - static String canonicalized_path(const StringView&); - static String relative_path(const String absolute_path, const String& prefix); + static String canonicalized_path(String); + static String relative_path(String absolute_path, String const& prefix); private: void canonicalize();