@@ -4377,219 +4377,6 @@ slow_search_backward_ic(OnigEncoding enc, int case_fold_flag,
43774377 return (UChar * )NULL ;
43784378}
43794379
4380- #ifndef USE_SUNDAY_QUICK_SEARCH
4381- /* Boyer-Moore-Horspool search applied to a multibyte string */
4382- static UChar *
4383- bm_search_notrev (regex_t * reg , const UChar * target , const UChar * target_end ,
4384- const UChar * text , const UChar * text_end ,
4385- const UChar * text_range )
4386- {
4387- const UChar * s , * se , * t , * p , * end ;
4388- const UChar * tail ;
4389- ptrdiff_t skip , tlen1 ;
4390-
4391- # ifdef ONIG_DEBUG_SEARCH
4392- fprintf (stderr , "bm_search_notrev: text: %" PRIuPTR " (%p), text_end: %" PRIuPTR " (%p), text_range: %" PRIuPTR " (%p)\n" ,
4393- (uintptr_t )text , text , (uintptr_t )text_end , text_end , (uintptr_t )text_range , text_range );
4394- # endif
4395-
4396- tail = target_end - 1 ;
4397- tlen1 = tail - target ;
4398- end = text_range ;
4399- if (end + tlen1 > text_end )
4400- end = text_end - tlen1 ;
4401-
4402- s = text ;
4403-
4404- if (IS_NULL (reg -> int_map )) {
4405- while (s < end ) {
4406- p = se = s + tlen1 ;
4407- t = tail ;
4408- while (* p == * t ) {
4409- if (t == target ) return (UChar * )s ;
4410- p -- ; t -- ;
4411- }
4412- skip = reg -> map [* se ];
4413- t = s ;
4414- do {
4415- s += enclen (reg -> enc , s , end );
4416- } while ((s - t ) < skip && s < end );
4417- }
4418- }
4419- else {
4420- # if OPT_EXACT_MAXLEN >= ONIG_CHAR_TABLE_SIZE
4421- while (s < end ) {
4422- p = se = s + tlen1 ;
4423- t = tail ;
4424- while (* p == * t ) {
4425- if (t == target ) return (UChar * )s ;
4426- p -- ; t -- ;
4427- }
4428- skip = reg -> int_map [* se ];
4429- t = s ;
4430- do {
4431- s += enclen (reg -> enc , s , end );
4432- } while ((s - t ) < skip && s < end );
4433- }
4434- # endif
4435- }
4436-
4437- return (UChar * )NULL ;
4438- }
4439-
4440- /* Boyer-Moore-Horspool search */
4441- static UChar *
4442- bm_search (regex_t * reg , const UChar * target , const UChar * target_end ,
4443- const UChar * text , const UChar * text_end , const UChar * text_range )
4444- {
4445- const UChar * s , * t , * p , * end ;
4446- const UChar * tail ;
4447-
4448- # ifdef ONIG_DEBUG_SEARCH
4449- fprintf (stderr , "bm_search: text: %" PRIuPTR " (%p), text_end: %" PRIuPTR " (%p), text_range: %" PRIuPTR " (%p)\n" ,
4450- (uintptr_t )text , text , (uintptr_t )text_end , text_end , (uintptr_t )text_range , text_range );
4451- # endif
4452-
4453- end = text_range + (target_end - target ) - 1 ;
4454- if (end > text_end )
4455- end = text_end ;
4456-
4457- tail = target_end - 1 ;
4458- s = text + (target_end - target ) - 1 ;
4459- if (IS_NULL (reg -> int_map )) {
4460- while (s < end ) {
4461- p = s ;
4462- t = tail ;
4463- # ifdef ONIG_DEBUG_SEARCH
4464- fprintf (stderr , "bm_search_loop: pos: %" PRIdPTR " %s\n" ,
4465- (intptr_t )(s - text ), s );
4466- # endif
4467- while (* p == * t ) {
4468- if (t == target ) return (UChar * )p ;
4469- p -- ; t -- ;
4470- }
4471- s += reg -> map [* s ];
4472- }
4473- }
4474- else { /* see int_map[] */
4475- # if OPT_EXACT_MAXLEN >= ONIG_CHAR_TABLE_SIZE
4476- while (s < end ) {
4477- p = s ;
4478- t = tail ;
4479- while (* p == * t ) {
4480- if (t == target ) return (UChar * )p ;
4481- p -- ; t -- ;
4482- }
4483- s += reg -> int_map [* s ];
4484- }
4485- # endif
4486- }
4487- return (UChar * )NULL ;
4488- }
4489-
4490- /* Boyer-Moore-Horspool search applied to a multibyte string (ignore case) */
4491- static UChar *
4492- bm_search_notrev_ic (regex_t * reg , const UChar * target , const UChar * target_end ,
4493- const UChar * text , const UChar * text_end ,
4494- const UChar * text_range )
4495- {
4496- const UChar * s , * se , * t , * end ;
4497- const UChar * tail ;
4498- ptrdiff_t skip , tlen1 ;
4499- OnigEncoding enc = reg -> enc ;
4500- int case_fold_flag = reg -> case_fold_flag ;
4501-
4502- # ifdef ONIG_DEBUG_SEARCH
4503- fprintf (stderr , "bm_search_notrev_ic: text: %d (%p), text_end: %d (%p), text_range: %d (%p)\n" ,
4504- (int )text , text , (int )text_end , text_end , (int )text_range , text_range );
4505- # endif
4506-
4507- tail = target_end - 1 ;
4508- tlen1 = tail - target ;
4509- end = text_range ;
4510- if (end + tlen1 > text_end )
4511- end = text_end - tlen1 ;
4512-
4513- s = text ;
4514-
4515- if (IS_NULL (reg -> int_map )) {
4516- while (s < end ) {
4517- se = s + tlen1 ;
4518- if (str_lower_case_match (enc , case_fold_flag , target , target_end ,
4519- s , se + 1 ))
4520- return (UChar * )s ;
4521- skip = reg -> map [* se ];
4522- t = s ;
4523- do {
4524- s += enclen (reg -> enc , s , end );
4525- } while ((s - t ) < skip && s < end );
4526- }
4527- }
4528- else {
4529- # if OPT_EXACT_MAXLEN >= ONIG_CHAR_TABLE_SIZE
4530- while (s < end ) {
4531- se = s + tlen1 ;
4532- if (str_lower_case_match (enc , case_fold_flag , target , target_end ,
4533- s , se + 1 ))
4534- return (UChar * )s ;
4535- skip = reg -> int_map [* se ];
4536- t = s ;
4537- do {
4538- s += enclen (reg -> enc , s , end );
4539- } while ((s - t ) < skip && s < end );
4540- }
4541- # endif
4542- }
4543-
4544- return (UChar * )NULL ;
4545- }
4546-
4547- /* Boyer-Moore-Horspool search (ignore case) */
4548- static UChar *
4549- bm_search_ic (regex_t * reg , const UChar * target , const UChar * target_end ,
4550- const UChar * text , const UChar * text_end , const UChar * text_range )
4551- {
4552- const UChar * s , * p , * end ;
4553- const UChar * tail ;
4554- OnigEncoding enc = reg -> enc ;
4555- int case_fold_flag = reg -> case_fold_flag ;
4556-
4557- # ifdef ONIG_DEBUG_SEARCH
4558- fprintf (stderr , "bm_search_ic: text: %d (%p), text_end: %d (%p), text_range: %d (%p)\n" ,
4559- (int )text , text , (int )text_end , text_end , (int )text_range , text_range );
4560- # endif
4561-
4562- end = text_range + (target_end - target ) - 1 ;
4563- if (end > text_end )
4564- end = text_end ;
4565-
4566- tail = target_end - 1 ;
4567- s = text + (target_end - target ) - 1 ;
4568- if (IS_NULL (reg -> int_map )) {
4569- while (s < end ) {
4570- p = s - (target_end - target ) + 1 ;
4571- if (str_lower_case_match (enc , case_fold_flag , target , target_end ,
4572- p , s + 1 ))
4573- return (UChar * )p ;
4574- s += reg -> map [* s ];
4575- }
4576- }
4577- else { /* see int_map[] */
4578- # if OPT_EXACT_MAXLEN >= ONIG_CHAR_TABLE_SIZE
4579- while (s < end ) {
4580- p = s - (target_end - target ) + 1 ;
4581- if (str_lower_case_match (enc , case_fold_flag , target , target_end ,
4582- p , s + 1 ))
4583- return (UChar * )p ;
4584- s += reg -> int_map [* s ];
4585- }
4586- # endif
4587- }
4588- return (UChar * )NULL ;
4589- }
4590-
4591- #else /* USE_SUNDAY_QUICK_SEARCH */
4592-
45934380/* Sunday's quick search applied to a multibyte string */
45944381static UChar *
45954382bm_search_notrev (regex_t * reg , const UChar * target , const UChar * target_end ,
@@ -4808,7 +4595,6 @@ bm_search_ic(regex_t* reg, const UChar* target, const UChar* target_end,
48084595 }
48094596 return (UChar * )NULL ;
48104597}
4811- #endif /* USE_SUNDAY_QUICK_SEARCH */
48124598
48134599#ifdef USE_INT_MAP_BACKWARD
48144600static int
0 commit comments