1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 03:07:35 +00:00

AK: Remove the LexicalPath::is_valid() API

Since this is always set to true on the non-default constructor and
subsequently never modified, it is somewhat pointless. Furthermore,
there are arguably no invalid relative paths.
This commit is contained in:
Max Wipfli 2021-06-29 13:11:03 +02:00 committed by Andreas Kling
parent caa9daf59e
commit 9b8f35259c
10 changed files with 14 additions and 66 deletions

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2021, Max Wipfli <max.wipfli@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -15,7 +16,6 @@ LexicalPath::LexicalPath(String s)
: m_string(move(s))
{
canonicalize();
m_is_valid = true;
}
void LexicalPath::canonicalize()

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2021, Max Wipfli <max.wipfli@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -16,7 +17,6 @@ public:
LexicalPath() = default;
explicit LexicalPath(String);
bool is_valid() const { return m_is_valid; }
bool is_absolute() const { return m_is_absolute; }
String const& string() const { return m_string; }
@ -53,7 +53,6 @@ private:
String m_basename;
String m_title;
String m_extension;
bool m_is_valid { false };
bool m_is_absolute { false };
};

View file

@ -162,7 +162,7 @@ u16 URL::default_port_for_scheme(StringView const& scheme)
URL URL::create_with_file_scheme(String const& path, String const& fragment, String const& hostname)
{
LexicalPath lexical_path(path);
if (!lexical_path.is_valid() || !lexical_path.is_absolute())
if (!lexical_path.is_absolute())
return {};
URL url;