aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-pcre/src
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-08-17 02:41:21 +0900
committernsfisis <nsfisis@gmail.com>2026-08-17 02:44:09 +0900
commitfcc6ee5a13cd2e2b27fff66dcfc7e9e1f062a653 (patch)
treea7966f53ae9f96ee583cb4105cf882fd137e1a1b /crates/shirabe-pcre/src
parent089215c1c26b4b09f697e3711416cbed0c53b0d3 (diff)
downloadphp-shirabe-fcc6ee5a13cd2e2b27fff66dcfc7e9e1f062a653.tar.gz
php-shirabe-fcc6ee5a13cd2e2b27fff66dcfc7e9e1f062a653.tar.zst
php-shirabe-fcc6ee5a13cd2e2b27fff66dcfc7e9e1f062a653.zip
refactor(preg): drop unused args of preg_match_all_offset_capture2()
The sole caller, Preg::match_all_with_offsets5(), always passed flags=0 and offset=0, so PREG_UNMATCHED_AS_NULL is now unconditional and the subject is scanned from the beginning. That method is only reached from Preg::match_all_with_offsets(), so it is no longer public either. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe-pcre/src')
-rw-r--r--crates/shirabe-pcre/src/preg.rs16
1 files changed, 3 insertions, 13 deletions
diff --git a/crates/shirabe-pcre/src/preg.rs b/crates/shirabe-pcre/src/preg.rs
index 95697e83..a761608e 100644
--- a/crates/shirabe-pcre/src/preg.rs
+++ b/crates/shirabe-pcre/src/preg.rs
@@ -83,23 +83,13 @@ impl Preg {
result
}
- pub fn match_all_with_offsets5(
+ fn match_all_with_offsets5(
pattern: impl PregPattern,
subject: &str,
matches: Option<&mut IndexMap<CaptureKey, Vec<(String, usize)>>>,
- flags: i64,
- offset: usize,
) -> usize {
- Self::check_set_order(flags);
-
let mut internal: IndexMap<CaptureKey, Vec<(Option<String>, i64)>> = IndexMap::new();
- let result = preg_match_all_offset_capture2(
- pattern,
- subject,
- &mut internal,
- flags | PREG_UNMATCHED_AS_NULL | PREG_OFFSET_CAPTURE,
- offset,
- );
+ let result = preg_match_all_offset_capture2(pattern, subject, &mut internal);
if let Some(out) = matches {
*out = null_to_empty_offset_match_all(internal);
@@ -263,7 +253,7 @@ impl Preg {
subject: &str,
matches: Option<&mut IndexMap<CaptureKey, Vec<(String, usize)>>>,
) -> bool {
- Self::match_all_with_offsets5(pattern, subject, matches, 0, 0) > 0
+ Self::match_all_with_offsets5(pattern, subject, matches) > 0
}
fn check_offset_capture(flags: i64, use_function_name: &str) {