summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2022-11-03 02:04:22 +0330
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2022-11-17 20:13:04 +0330
commit464ac85a1bd8be4e0a00a7058add8314799d165e (patch)
treedcc8d9809aafdc63075b29d163e2efae225b35bf /Userland/Libraries
parent73fcbbb0eee6c549c63d4294b02d1e2da7353fe6 (diff)
downloadserenity-464ac85a1bd8be4e0a00a7058add8314799d165e.zip
LibRegex: Avoid copying MatchInput when getting argument descriptions
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibRegex/RegexByteCode.cpp4
-rw-r--r--Userland/Libraries/LibRegex/RegexByteCode.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Libraries/LibRegex/RegexByteCode.cpp b/Userland/Libraries/LibRegex/RegexByteCode.cpp
index e94ec356da..8122e11164 100644
--- a/Userland/Libraries/LibRegex/RegexByteCode.cpp
+++ b/Userland/Libraries/LibRegex/RegexByteCode.cpp
@@ -927,12 +927,12 @@ Vector<CompareTypeAndValuePair> OpCode_Compare::flat_compares() const
return result;
}
-Vector<String> OpCode_Compare::variable_arguments_to_string(Optional<MatchInput> input) const
+Vector<String> OpCode_Compare::variable_arguments_to_string(Optional<MatchInput const&> input) const
{
Vector<String> result;
size_t offset { state().instruction_position + 3 };
- RegexStringView view = ((input.has_value()) ? input.value().view : StringView {});
+ RegexStringView const& view = ((input.has_value()) ? input.value().view : StringView {});
for (size_t i = 0; i < arguments_count(); ++i) {
auto compare_type = (CharacterCompareType)m_bytecode->at(offset++);
diff --git a/Userland/Libraries/LibRegex/RegexByteCode.h b/Userland/Libraries/LibRegex/RegexByteCode.h
index 2c4ab3aa8a..b3e6231139 100644
--- a/Userland/Libraries/LibRegex/RegexByteCode.h
+++ b/Userland/Libraries/LibRegex/RegexByteCode.h
@@ -746,7 +746,7 @@ public:
ALWAYS_INLINE size_t arguments_count() const { return argument(0); }
ALWAYS_INLINE size_t arguments_size() const { return argument(1); }
String arguments_string() const override;
- Vector<String> variable_arguments_to_string(Optional<MatchInput> input = {}) const;
+ Vector<String> variable_arguments_to_string(Optional<MatchInput const&> input = {}) const;
Vector<CompareTypeAndValuePair> flat_compares() const;
static bool matches_character_class(CharClass, u32, bool insensitive);