mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-16 05:51:55 +00:00
LibRegex: Remove the StringCopyMatches mode
This mode made a lot of incorrect assumptions about string lifetimes, and instead of fixing it, let's just remove it and tweak the few unit tests that used it.
This commit is contained in:
parent
f1914893e9
commit
6b6d3b32a4
Notes:
github-actions[bot]
2025-03-24 22:28:15 +00:00
Author: https://github.com/awesomekling
Commit: 6b6d3b32a4
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4067
Reviewed-by: https://github.com/trflynn89
6 changed files with 14 additions and 29 deletions
|
@ -197,11 +197,7 @@ RegexResult Matcher<Parser>::match(Vector<RegexStringView> const& views, Optiona
|
|||
state.matches.empend();
|
||||
|
||||
VERIFY(start_position + state.string_position - start_position <= input.view.length());
|
||||
if (input.regex_options.has_flag_set(AllFlags::StringCopyMatches)) {
|
||||
state.matches.mutable_at(input.match_index) = { input.view.substring_view(start_position, state.string_position - start_position).to_byte_string(), input.line, start_position, input.global_offset + start_position };
|
||||
} else { // let the view point to the original string ...
|
||||
state.matches.mutable_at(input.match_index) = { input.view.substring_view(start_position, state.string_position - start_position), input.line, start_position, input.global_offset + start_position };
|
||||
}
|
||||
state.matches.mutable_at(input.match_index) = { input.view.substring_view(start_position, state.string_position - start_position), input.line, start_position, input.global_offset + start_position };
|
||||
};
|
||||
|
||||
#if REGEX_DEBUG
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue