diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2022-11-03 02:04:22 +0330 |
---|---|---|
committer | Ali Mohammad Pur <Ali.mpfard@gmail.com> | 2022-11-17 20:13:04 +0330 |
commit | 464ac85a1bd8be4e0a00a7058add8314799d165e (patch) | |
tree | dcc8d9809aafdc63075b29d163e2efae225b35bf /Userland | |
parent | 73fcbbb0eee6c549c63d4294b02d1e2da7353fe6 (diff) | |
download | serenity-464ac85a1bd8be4e0a00a7058add8314799d165e.zip |
LibRegex: Avoid copying MatchInput when getting argument descriptions
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibRegex/RegexByteCode.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibRegex/RegexByteCode.h | 2 |
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); |