aboutsummaryrefslogtreecommitdiffstats
path: root/regint.h
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2022-03-24 16:59:11 +0900
committerYusuke Endoh <mame@ruby-lang.org>2022-03-30 16:50:46 +0900
commitffc3b37f969a779f93b8f8a5b3591b4ef7de1538 (patch)
tree25b2d942e8eb2c4a73043773edfcfd6c0d709155 /regint.h
parent23530d68cb04aed9c2f59a050523b0193ee2d0c1 (diff)
downloadruby-ffc3b37f969a779f93b8f8a5b3591b4ef7de1538.tar.gz
re.c: Add Regexp.timeout= and Regexp.timeout
[Feature #17837]
Diffstat (limited to 'regint.h')
-rw-r--r--regint.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/regint.h b/regint.h
index 0e9777cc1e..6c88f278c1 100644
--- a/regint.h
+++ b/regint.h
@@ -152,6 +152,7 @@
msa->counter++; \
if (msa->counter >= 128) { \
msa->counter = 0; \
+ rb_reg_check_timeout(reg, &msa->end_time); \
rb_thread_check_ints(); \
} \
} while(0)
@@ -877,6 +878,12 @@ typedef struct {
int state_check_buff_size;
#endif
int counter;
+ /* rb_hrtime_t from hrtime.h */
+#ifdef MY_RUBY_BUILD_MAY_TIME_TRAVEL
+ int128_t end_time;
+#else
+ uint64_t end_time;
+#endif
} OnigMatchArg;
@@ -942,6 +949,7 @@ extern int onig_st_insert_strend(hash_table_type* table, const UChar* str_key, c
#ifdef RUBY
extern size_t onig_memsize(const regex_t *reg);
extern size_t onig_region_memsize(const struct re_registers *regs);
+void rb_reg_check_timeout(regex_t *reg, void *end_time);
#endif
RUBY_SYMBOL_EXPORT_END