diff options
author | Nobuyoshi Nakada <[email protected]> | 2023-06-09 16:10:30 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2023-06-09 20:22:30 +0900 |
commit | ab6eb3786c94e69c561080cbb796c2381702a3a4 (patch) | |
tree | 2fe551edd62566939a7760439851fd7ad90b2d13 /include/ruby | |
parent | d54f66d1b4ce32d78b526b1ea9e3f213a763d07c (diff) |
Optimize `Regexp#dup` and `Regexp.new(/RE/)`
When copying from another regexp, copy already built `regex_t` instead
of re-compiling its source.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/7922
Diffstat (limited to 'include/ruby')
-rw-r--r-- | include/ruby/onigmo.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/ruby/onigmo.h b/include/ruby/onigmo.h index 0a5400c3a5..d233336316 100644 --- a/include/ruby/onigmo.h +++ b/include/ruby/onigmo.h @@ -844,6 +844,8 @@ void onig_free(OnigRegex); ONIG_EXTERN void onig_free_body(OnigRegex); ONIG_EXTERN +int onig_reg_copy(OnigRegex* reg, OnigRegex orig_reg); +ONIG_EXTERN OnigPosition onig_scan(OnigRegex reg, const OnigUChar* str, const OnigUChar* end, OnigRegion* region, OnigOptionType option, int (*scan_callback)(OnigPosition, OnigPosition, OnigRegion*, void*), void* callback_arg); ONIG_EXTERN OnigPosition onig_search(OnigRegex, const OnigUChar* str, const OnigUChar* end, const OnigUChar* start, const OnigUChar* range, OnigRegion* region, OnigOptionType option); |