mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-07 01:21:57 +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
|
@ -387,13 +387,7 @@ ALWAYS_INLINE ExecutionResult OpCode_SaveRightCaptureGroup::execute(MatchInput c
|
|||
|
||||
VERIFY(start_position + length <= input.view.length());
|
||||
|
||||
auto view = input.view.substring_view(start_position, length);
|
||||
|
||||
if (input.regex_options & AllFlags::StringCopyMatches) {
|
||||
match = { view.to_byte_string(), input.line, start_position, input.global_offset + start_position }; // create a copy of the original string
|
||||
} else {
|
||||
match = { view, input.line, start_position, input.global_offset + start_position }; // take view to original string
|
||||
}
|
||||
match = { input.view.substring_view(start_position, length), input.line, start_position, input.global_offset + start_position };
|
||||
|
||||
return ExecutionResult::Continue;
|
||||
}
|
||||
|
@ -414,11 +408,7 @@ ALWAYS_INLINE ExecutionResult OpCode_SaveRightNamedCaptureGroup::execute(MatchIn
|
|||
|
||||
auto view = input.view.substring_view(start_position, length);
|
||||
|
||||
if (input.regex_options & AllFlags::StringCopyMatches) {
|
||||
match = { view.to_byte_string(), name(), input.line, start_position, input.global_offset + start_position }; // create a copy of the original string
|
||||
} else {
|
||||
match = { view, name(), input.line, start_position, input.global_offset + start_position }; // take view to original string
|
||||
}
|
||||
match = { view, name(), input.line, start_position, input.global_offset + start_position };
|
||||
|
||||
return ExecutionResult::Continue;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue