summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibMarkdown/Text.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-11-11 00:55:02 +0100
committerAndreas Kling <kling@serenityos.org>2021-11-11 01:27:46 +0100
commit8b1108e4858f797c9216dc8ae4a3918ad50c73b4 (patch)
treeca64ba25aa735d25013d76c6d83570496c742014 /Userland/Libraries/LibMarkdown/Text.cpp
parentad5d217e760c7fb73ffc0c4c827d767d6be8ec80 (diff)
downloadserenity-8b1108e4858f797c9216dc8ae4a3918ad50c73b4.zip
Everywhere: Pass AK::StringView by value
Diffstat (limited to 'Userland/Libraries/LibMarkdown/Text.cpp')
-rw-r--r--Userland/Libraries/LibMarkdown/Text.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/Userland/Libraries/LibMarkdown/Text.cpp b/Userland/Libraries/LibMarkdown/Text.cpp
index 94a4456699..faae1d4353 100644
--- a/Userland/Libraries/LibMarkdown/Text.cpp
+++ b/Userland/Libraries/LibMarkdown/Text.cpp
@@ -251,7 +251,7 @@ RecursionDecision Text::walk(Visitor& visitor) const
return m_node->walk(visitor);
}
-Text Text::parse(StringView const& str)
+Text Text::parse(StringView str)
{
Text text;
auto const tokens = tokenize(str);
@@ -260,7 +260,7 @@ Text Text::parse(StringView const& str)
return text;
}
-static bool flanking(StringView const& str, size_t start, size_t end, int dir)
+static bool flanking(StringView str, size_t start, size_t end, int dir)
{
ssize_t next = ((dir > 0) ? end : start) + dir;
if (next < 0 || next >= (ssize_t)str.length())
@@ -279,7 +279,7 @@ static bool flanking(StringView const& str, size_t start, size_t end, int dir)
return isspace(str[prev]) || ispunct(str[prev]);
}
-Vector<Text::Token> Text::tokenize(StringView const& str)
+Vector<Text::Token> Text::tokenize(StringView str)
{
Vector<Token> tokens;
StringBuilder current_token;
@@ -306,14 +306,14 @@ Vector<Text::Token> Text::tokenize(StringView const& str)
bool in_space = false;
for (size_t offset = 0; offset < str.length(); ++offset) {
- auto has = [&](StringView const& seq) {
+ auto has = [&](StringView seq) {
if (offset + seq.length() > str.length())
return false;
return str.substring_view(offset, seq.length()) == seq;
};
- auto expect = [&](StringView const& seq) {
+ auto expect = [&](StringView seq) {
VERIFY(has(seq));
flush_token();
current_token.append(seq);