summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2021-07-31 18:52:24 +0430
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2021-08-02 17:22:50 +0430
commitd5984d296f10a365d779d672318f37592e13a98e (patch)
tree9977c2c0ea739cda68137e652256cc62cbd6d288
parenta7653e6a0511e82544e9bc092a7f782f40a3c000 (diff)
downloadserenity-d5984d296f10a365d779d672318f37592e13a98e.zip
LibRegex: Make Matcher<>::match(Vector<>) take a reference to the vector
It was previously copying the entire vector every time, which is not a nice thing to do. :^)
-rw-r--r--Userland/Libraries/LibRegex/RegexMatcher.cpp2
-rw-r--r--Userland/Libraries/LibRegex/RegexMatcher.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Libraries/LibRegex/RegexMatcher.cpp b/Userland/Libraries/LibRegex/RegexMatcher.cpp
index 3603df182e..ffb6b5bf3d 100644
--- a/Userland/Libraries/LibRegex/RegexMatcher.cpp
+++ b/Userland/Libraries/LibRegex/RegexMatcher.cpp
@@ -111,7 +111,7 @@ RegexResult Matcher<Parser>::match(RegexStringView const& view, Optional<typenam
}
template<typename Parser>
-RegexResult Matcher<Parser>::match(Vector<RegexStringView> const views, Optional<typename ParserTraits<Parser>::OptionsType> regex_options) const
+RegexResult Matcher<Parser>::match(Vector<RegexStringView> const& views, Optional<typename ParserTraits<Parser>::OptionsType> regex_options) const
{
// If the pattern *itself* isn't stateful, reset any changes to start_offset.
if (!((AllFlags)m_regex_options.value() & AllFlags::Internal_Stateful))
diff --git a/Userland/Libraries/LibRegex/RegexMatcher.h b/Userland/Libraries/LibRegex/RegexMatcher.h
index 4524fa4dc0..8e1ce64e6d 100644
--- a/Userland/Libraries/LibRegex/RegexMatcher.h
+++ b/Userland/Libraries/LibRegex/RegexMatcher.h
@@ -52,7 +52,7 @@ public:
~Matcher() = default;
RegexResult match(RegexStringView const&, Optional<typename ParserTraits<Parser>::OptionsType> = {}) const;
- RegexResult match(Vector<RegexStringView> const, Optional<typename ParserTraits<Parser>::OptionsType> = {}) const;
+ RegexResult match(Vector<RegexStringView> const&, Optional<typename ParserTraits<Parser>::OptionsType> = {}) const;
typename ParserTraits<Parser>::OptionsType options() const
{