From: K.Kosako Date: Sat, 22 Sep 2018 12:25:04 +0000 (+0900) Subject: refactoring X-Git-Tag: v6.9.1~18^2~59 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1ae3ae30f0683dfe627082604cc9e592d85a7b18;p=onig refactoring --- diff --git a/src/regcomp.c b/src/regcomp.c index 08dc3d6..f25d1d5 100644 --- a/src/regcomp.c +++ b/src/regcomp.c @@ -5583,7 +5583,7 @@ set_optimize_exact(regex_t* reg, OptExact* e) if (r != 0) return r; reg->optimize = (allow_reverse != 0 - ? OPTIMIZE_EXACT_BMH : OPTIMIZE_EXACT_BMH_FORWARD); + ? OPTIMIZE_EXACT_BMH : OPTIMIZE_EXACT_BMH_STEP_FORWARD); } else { reg->optimize = OPTIMIZE_EXACT; @@ -5809,7 +5809,7 @@ static void print_optimize_info(FILE* f, regex_t* reg) { static const char* on[] = { "NONE", "EXACT", - "EXACT_BMH", "EXACT_BMH_FORWARD", + "EXACT_BMH", "EXACT_BMH_STEP_FORWARD", "EXACT_IC", "MAP" }; fprintf(f, "optimize: %s\n", on[reg->optimize]); diff --git a/src/regexec.c b/src/regexec.c index 48886bf..420e18d 100644 --- a/src/regexec.c +++ b/src/regexec.c @@ -4115,9 +4115,10 @@ slow_search_backward_ic(OnigEncoding enc, int case_fold_flag, #ifdef USE_SUNDAY_QUICK_SEARCH_ALGORITHM static UChar* -bmh_search_forward(regex_t* reg, const UChar* target, const UChar* target_end, - const UChar* text, const UChar* text_end, - const UChar* text_range) +bmh_search_step_forward(regex_t* reg, + const UChar* target, const UChar* target_end, + const UChar* text, const UChar* text_end, + const UChar* text_range) { const UChar *s, *se, *t, *p, *end; const UChar *tail; @@ -4125,7 +4126,7 @@ bmh_search_forward(regex_t* reg, const UChar* target, const UChar* target_end, #ifdef ONIG_DEBUG_SEARCH fprintf(stderr, - "bmh_search_forward: text: %p, text_end: %p, text_range: %p\n", + "bmh_search_step_forward: text: %p, text_end: %p, text_range: %p\n", text, text_end, text_range); #endif @@ -4186,9 +4187,10 @@ bmh_search(regex_t* reg, const UChar* target, const UChar* target_end, #else static UChar* -bmh_search_forward(regex_t* reg, const UChar* target, const UChar* target_end, - const UChar* text, const UChar* text_end, - const UChar* text_range) +bmh_search_step_forward(regex_t* reg, + const UChar* target, const UChar* target_end, + const UChar* text, const UChar* text_end, + const UChar* text_range) { const UChar *s, *se, *t, *p, *end; const UChar *tail; @@ -4196,7 +4198,7 @@ bmh_search_forward(regex_t* reg, const UChar* target, const UChar* target_end, #ifdef ONIG_DEBUG_SEARCH fprintf(stderr, - "bmh_search_forward: text: %p, text_end: %p, text_range: %p\n", + "bmh_search_step_forward: text: %p, text_end: %p, text_range: %p\n", text, text_end, text_range); #endif @@ -4370,8 +4372,9 @@ forward_search_range(regex_t* reg, const UChar* str, const UChar* end, UChar* s, p = bmh_search(reg, reg->exact, reg->exact_end, p, end, range); break; - case OPTIMIZE_EXACT_BMH_FORWARD: - p = bmh_search_forward(reg, reg->exact, reg->exact_end, p, end, range); + case OPTIMIZE_EXACT_BMH_STEP_FORWARD: + p = bmh_search_step_forward(reg, reg->exact, reg->exact_end, + p, end, range); break; case OPTIMIZE_MAP: @@ -4493,7 +4496,7 @@ backward_search_range(regex_t* reg, const UChar* str, const UChar* end, break; case OPTIMIZE_EXACT_BMH: - case OPTIMIZE_EXACT_BMH_FORWARD: + case OPTIMIZE_EXACT_BMH_STEP_FORWARD: goto exact_method; break; diff --git a/src/regint.h b/src/regint.h index 50a9e36..b8950c0 100644 --- a/src/regint.h +++ b/src/regint.h @@ -317,12 +317,12 @@ enum StackPopLevel { /* optimize flags */ enum OptimizeType { - OPTIMIZE_NONE = 0, - OPTIMIZE_EXACT = 1, /* Slow Search */ - OPTIMIZE_EXACT_BMH = 2, /* Boyer-Moore-Horspool */ - OPTIMIZE_EXACT_BMH_FORWARD = 3, /* Boyer-Moore-Horspool (forward) */ - OPTIMIZE_EXACT_IC = 4, /* Slow Search (ignore case) */ - OPTIMIZE_MAP = 5 /* char map */ + OPTIMIZE_NONE = 0, + OPTIMIZE_EXACT = 1, /* Slow Search */ + OPTIMIZE_EXACT_BMH = 2, /* Boyer-Moore-Horspool */ + OPTIMIZE_EXACT_BMH_STEP_FORWARD = 3, /* Boyer-Moore-Horspool */ + OPTIMIZE_EXACT_IC = 4, /* Slow Search (ignore case) */ + OPTIMIZE_MAP = 5 /* char map */ }; /* bit status */