aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorK.Kosako <kkosako0@gmail.com>2018-10-03 21:32:03 +0900
committerK.Kosako <kkosako0@gmail.com>2018-10-03 21:32:03 +0900
commit4dcd2a5102466f22fe061f0e6abbbdd5a4aaf7cc (patch)
tree1ac2fc113db933d7999ced07bb2307a584f8a3ba
parent84883cf23fbb798bd973f92337870a926e781c08 (diff)
downloadoniguruma-4dcd2a5102466f22fe061f0e6abbbdd5a4aaf7cc.zip
oniguruma-4dcd2a5102466f22fe061f0e6abbbdd5a4aaf7cc.tar.gz
oniguruma-4dcd2a5102466f22fe061f0e6abbbdd5a4aaf7cc.tar.bz2
use OPTIMIZE_STR_CASE_FOLD_FAST
-rw-r--r--src/regcomp.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/regcomp.c b/src/regcomp.c
index 58ac85b..3dfd00c 100644
--- a/src/regcomp.c
+++ b/src/regcomp.c
@@ -5714,6 +5714,17 @@ set_optimize_exact(regex_t* reg, OptExact* e)
if (e->case_fold) {
reg->optimize = OPTIMIZE_STR_CASE_FOLD;
+#ifdef USE_SUNDAY_QUICK_SEARCH_ALGORITHM
+ if (e->good_case_fold != 0) {
+ if (e->len >= 2) {
+ r = set_sunday_quick_search_skip_table(reg, 1,
+ reg->exact, reg->exact_end,
+ reg->map, &(reg->map_offset));
+ if (r != 0) return r;
+ reg->optimize = OPTIMIZE_STR_CASE_FOLD_FAST;
+ }
+ }
+#endif
}
else {
int allow_reverse;
@@ -5721,7 +5732,7 @@ set_optimize_exact(regex_t* reg, OptExact* e)
allow_reverse =
ONIGENC_IS_ALLOWED_REVERSE_MATCH(reg->enc, reg->exact, reg->exact_end);
- if (e->len >= 3 || (e->len >= 2 && allow_reverse)) {
+ if (e->len >= 2 || (e->len >= 1 && allow_reverse)) {
#ifdef USE_SUNDAY_QUICK_SEARCH_ALGORITHM
r = set_sunday_quick_search_skip_table(reg, 0, reg->exact, reg->exact_end,
reg->map, &(reg->map_offset));