From d5984d296f10a365d779d672318f37592e13a98e Mon Sep 17 00:00:00 2001 From: Ali Mohammad Pur Date: Sat, 31 Jul 2021 18:52:24 +0430 Subject: [PATCH] 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. :^) --- Userland/Libraries/LibRegex/RegexMatcher.cpp | 2 +- Userland/Libraries/LibRegex/RegexMatcher.h | 2 +- 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::match(RegexStringView const& view, Optional -RegexResult Matcher::match(Vector const views, Optional::OptionsType> regex_options) const +RegexResult Matcher::match(Vector const& views, Optional::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::OptionsType> = {}) const; - RegexResult match(Vector const, Optional::OptionsType> = {}) const; + RegexResult match(Vector const&, Optional::OptionsType> = {}) const; typename ParserTraits::OptionsType options() const {