static UChar*
sunday_quick_search_step_forward(regex_t* reg,
- const UChar* target, const UChar* target_end,
- const UChar* text, const UChar* text_end,
+ 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;
return (UChar* )NULL;
}
+static UChar*
+sunday_quick_search_case_fold(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, *p, *end;
+ const UChar *tail;
+ int skip, tlen1;
+ int map_offset;
+ int case_fold_flag;
+ OnigEncoding enc;
+
+#ifdef ONIG_DEBUG_SEARCH
+ fprintf(stderr,
+ "sunday_quick_search_case_fold: text: %p, text_end: %p, text_range: %p\n", text, text_end, text_range);
+#endif
+
+ enc = reg->enc;
+ case_fold_flag = reg->case_fold_flag;
+
+ tail = target_end - 1;
+ tlen1 = (int )(tail - target);
+ end = text_range;
+ if (end + tlen1 > text_end)
+ end = text_end - tlen1;
+
+ map_offset = reg->map_offset;
+ s = text;
+
+ while (s < end) {
+ if (str_lower_case_match(enc, case_fold_flag, target, target_end,
+ s, text_end))
+ return (UChar* )s;
+
+ se = s + tlen1;
+ if (se + map_offset >= text_end) break;
+ skip = reg->map[*(se + map_offset)];
+ p = s;
+ do {
+ s += enclen(reg->enc, s);
+ } while ((s - p) < skip && s < end);
+ }
+
+ return (UChar* )NULL;
+}
+
#else
static UChar*
reg->exact, reg->exact_end, p, end, range);
break;
+ case OPTIMIZE_STR_CASE_FOLD_FAST:
+#ifdef USE_SUNDAY_QUICK_SEARCH_ALGORITHM
+ p = sunday_quick_search_case_fold(reg, reg->exact, reg->exact_end, p, end,
+ range);
+#else
+ p = slow_search_ic(reg->enc, reg->case_fold_flag,
+ reg->exact, reg->exact_end, p, end, range);
+#endif
+ break;
+
case OPTIMIZE_STR_FAST:
#ifdef USE_SUNDAY_QUICK_SEARCH_ALGORITHM
p = sunday_quick_search(reg, reg->exact, reg->exact_end, p, end, range);
break;
case OPTIMIZE_STR_CASE_FOLD:
+ case OPTIMIZE_STR_CASE_FOLD_FAST:
p = slow_search_backward_ic(reg->enc, reg->case_fold_flag,
reg->exact, reg->exact_end,
range, adjrange, end, p);