mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Add Regexp.linear_time?
(#6901)
This commit is contained in:
parent
fe3cbc61c8
commit
fbedadb61f
Notes:
git
2022-12-14 03:57:33 +00:00
Merged-By: makenowjust <make.just.on@gmail.com>
4 changed files with 59 additions and 1 deletions
16
regexec.c
16
regexec.c
|
@ -694,7 +694,21 @@ unexpected_bytecode_error:
|
|||
bytecode_error:
|
||||
return ONIGERR_UNDEFINED_BYTECODE;
|
||||
}
|
||||
#endif /* USE_MATCH_CACHE */
|
||||
#else /* USE_MATCH_CACHE */
|
||||
static OnigPosition count_num_cache_opcode(regex_t* reg, long* num, long* table_size)
|
||||
{
|
||||
*num = NUM_CACHE_OPCODE_FAIL;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
extern int
|
||||
onig_check_linear_time(OnigRegexType* reg)
|
||||
{
|
||||
long num = 0, table_size = 0;
|
||||
count_num_cache_opcode(reg, &num, &table_size);
|
||||
return num != NUM_CACHE_OPCODE_FAIL;
|
||||
}
|
||||
|
||||
extern void
|
||||
onig_region_clear(OnigRegion* region)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue