From 257de2ec53eb6a0a75a16608b84e071a88a6b73c Mon Sep 17 00:00:00 2001 From: "K.Kosako" Date: Mon, 24 Sep 2018 11:00:50 +0900 Subject: [PATCH] refactoring --- src/regcomp.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/regcomp.c b/src/regcomp.c index 4d0ffe7..00f7a17 100644 --- a/src/regcomp.c +++ b/src/regcomp.c @@ -4555,8 +4555,8 @@ setup_tree(Node* node, regex_t* reg, int state, ScanEnv* env) #ifdef USE_SUNDAY_QUICK_SEARCH_ALGORITHM /* set skip map for Sunday quick search */ static int -set_search_skip_table(UChar* s, UChar* end, - OnigEncoding enc ARG_UNUSED, UChar skip[]) +set_sunday_quick_search_skip_table(UChar* s, UChar* end, + OnigEncoding enc ARG_UNUSED, UChar skip[]) { int i, len; @@ -4574,8 +4574,8 @@ set_search_skip_table(UChar* s, UChar* end, #else /* set skip map for Boyer-Moore-Horspool search */ static int -set_search_skip_table(UChar* s, UChar* end, - OnigEncoding enc ARG_UNUSED, UChar skip[]) +set_bmh_search_skip_table(UChar* s, UChar* end, + OnigEncoding enc ARG_UNUSED, UChar skip[]) { int i, len; @@ -5582,8 +5582,13 @@ set_optimize_exact(regex_t* reg, OptExact* e) ONIGENC_IS_ALLOWED_REVERSE_MATCH(reg->enc, reg->exact, reg->exact_end); if (e->len >= 3 || (e->len >= 2 && allow_reverse)) { - r = set_search_skip_table(reg->exact, reg->exact_end, - reg->enc, reg->map); +#ifdef USE_SUNDAY_QUICK_SEARCH_ALGORITHM + r = set_sunday_quick_search_skip_table(reg->exact, reg->exact_end, + reg->enc, reg->map); +#else + r = set_bmh_search_skip_table(reg->exact, reg->exact_end, + reg->enc, reg->map); +#endif if (r != 0) return r; reg->optimize = (allow_reverse != 0 -- 2.40.0