diff options
author | Rui Hirokawa <hirokawa@php.net> | 2005-03-19 08:52:23 +0000 |
---|---|---|
committer | Rui Hirokawa <hirokawa@php.net> | 2005-03-19 08:52:23 +0000 |
commit | c30f4ab6eca4b885cf436c8844472f00349b62cc (patch) | |
tree | a796ef3fc5b087d3c7afa903fe5ff9a9b1ff5d7d | |
parent | 1168c306359b2b763274bf2d1fbf21ade775ebcb (diff) | |
download | php-git-c30f4ab6eca4b885cf436c8844472f00349b62cc.tar.gz |
oniguruma updated to 3.7.1 and changed UChar to OnigUChar.
-rw-r--r-- | ext/mbstring/oniguruma/HISTORY | 14 | ||||
-rw-r--r-- | ext/mbstring/oniguruma/enc/koi8.c | 8 | ||||
-rwxr-xr-x | ext/mbstring/oniguruma/index.html | 31 | ||||
-rw-r--r-- | ext/mbstring/oniguruma/oniggnu.h | 38 | ||||
-rw-r--r-- | ext/mbstring/oniguruma/oniguruma.h | 78 | ||||
-rw-r--r-- | ext/mbstring/oniguruma/regcomp.c | 3 | ||||
-rw-r--r-- | ext/mbstring/oniguruma/regexec.c | 33 | ||||
-rw-r--r-- | ext/mbstring/oniguruma/reggnu.c | 2 | ||||
-rw-r--r-- | ext/mbstring/oniguruma/regint.h | 2 | ||||
-rw-r--r-- | ext/mbstring/php_mbregex.c | 50 |
10 files changed, 125 insertions, 134 deletions
diff --git a/ext/mbstring/oniguruma/HISTORY b/ext/mbstring/oniguruma/HISTORY index 65ef03f50f..c648c54551 100644 --- a/ext/mbstring/oniguruma/HISTORY +++ b/ext/mbstring/oniguruma/HISTORY @@ -1,5 +1,19 @@ History +2005/03/07: Version 3.7.1 + +2005/03/07: [test] success in ruby 1.9.0 (2005-03-07) [i686-linux]. +2005/03/07: [impl] (thanks Rui Hirokawa) + add ONIG_ESCAPE_UCHAR_COLLISION. + rename UChar to OnigUChar in oniguruma.h. +2005/03/07: [impl] remove declarations for Ruby in oniggnu.h. +2005/03/05: [bug] ANCHOR_ANYCHAR_STAR didn't work in onig_search(). +2005/03/01: [dist] remove oniggnu.h from MANIFEST-RUBY. + remove oniggnu.h from make 19. +2005/03/01: [bug] (thanks matz) [ruby-dev:25778] + uninitialized member (OptEnv.backrefed_status) + was used. + 2005/02/19: Version 3.7.0 2005/02/19: [test] success in ruby 1.9.0 (2005-02-19) [i386-cygwin]. diff --git a/ext/mbstring/oniguruma/enc/koi8.c b/ext/mbstring/oniguruma/enc/koi8.c index f8a5a1da61..84afa1afef 100644 --- a/ext/mbstring/oniguruma/enc/koi8.c +++ b/ext/mbstring/oniguruma/enc/koi8.c @@ -105,9 +105,9 @@ static unsigned short EncKOI8_CtypeTable[256] = { static int koi8_mbc_to_normalize(OnigAmbigType flag, - const UChar** pp, const UChar* end, UChar* lower) + UChar** pp, UChar* end, UChar* lower) { - UChar* p = (UChar *)*pp; + UChar* p = *pp; if (((flag & ONIGENC_AMBIGUOUS_MATCH_ASCII_CASE) != 0 && ONIGENC_IS_MBC_ASCII(p)) || @@ -123,9 +123,9 @@ koi8_mbc_to_normalize(OnigAmbigType flag, } static int -koi8_is_mbc_ambiguous(OnigAmbigType flag, const UChar** pp, const UChar* end) +koi8_is_mbc_ambiguous(OnigAmbigType flag, UChar** pp, UChar* end) { - UChar* p = (UChar *)*pp; + UChar* p = *pp; (*pp)++; if (((flag & ONIGENC_AMBIGUOUS_MATCH_ASCII_CASE) != 0 && diff --git a/ext/mbstring/oniguruma/index.html b/ext/mbstring/oniguruma/index.html index 293ea442a3..02e844c363 100755 --- a/ext/mbstring/oniguruma/index.html +++ b/ext/mbstring/oniguruma/index.html @@ -5,14 +5,18 @@ </head> <body BGCOLOR="#ffffff" VLINK="#808040" TEXT="#696969"> -<h2>Oniguruma</h2> -<p> -2005/02/19 (C) K.Kosako -</p> -<p> +<!-- <a href="http://miuras.net/matsushita.html"> <img src="anti_matsushita.PNG" height="46" width="266"> </a> +--> +<a href="http://miuras.net/matsushita.html">M</a> +<a href="http://www.micropac.co.jp/nec/">N</a> + +<h1>Oniguruma</h1> + +<p> +2005/03/07 (C) K.Kosako </p> <p> @@ -38,7 +42,8 @@ ISO-8859-11, ISO-8859-13, ISO-8859-14, ISO-8859-15, ISO-8859-16 <dt><b>What's new</b> </font> <ul> -<li>Character types(\w, \s, \d and POSIX bracket) were supported in full code point range with the Version 4.0.1 of the <a href="http://www.unicode.org/ucd/">Unicode Standard</a>. (since Version 3.5.0) +<li>released Version 3.7.1 (2005/03/07) +<li>released Version 2.4.2 (2005/03/05) </ul> </dl> @@ -49,7 +54,7 @@ ISO-8859-11, ISO-8859-13, ISO-8859-14, ISO-8859-15, ISO-8859-16 <ul> <li> (1) C library (supported APIs: GNU regex, POSIX and Oniguruma native) <li> (2) Built-in regular expressions engine of <a href="http://www.ruby-lang.org/">Ruby</a> 1.6/1.8/1.9 <br> - In Ruby 1.9, Oniguruma is already incorporated by Kazuo Saito. + In Ruby 1.9, Oniguruma is already integrated by Kazuo Saito. </ul> </dl> @@ -70,12 +75,12 @@ It follows the BSD license in the case of the one except for it. <dt><b>Download:</b> <ul> -<li> <a href="archive/onigd20050219.tar.gz">Latest release version 3.7.0</a> (2005/02/19) <a href="HISTORY_3X.txt">Change Log</a> +<li> <a href="archive/onigd20050307.tar.gz">Latest release version 3.7.1</a> (2005/03/07) <a href="HISTORY_3X.txt">Change Log</a> +<li> <a href="archive/onigd20050219.tar.gz">3.7.0</a> (2005/02/19) <li> <a href="archive/onigd20050204.tar.gz">3.6.0</a> (2005/02/04) -<li> <a href="archive/onigd20050119.tar.gz">3.5.4</a> (2005/01/19) -<li> <a href="archive/onigd2_4_1.tar.gz">Latest release version 2.4.1</a> (2005/01/05) <a href="HISTORY_2X.txt">Change Log</a> +<li> <a href="archive/onigd2_4_2.tar.gz">Latest release version 2.4.2</a> (2005/03/05) <a href="HISTORY_2X.txt">Change Log</a> +<li> <a href="archive/onigd2_4_1.tar.gz">2.4.1</a> (2005/01/05) <li> <a href="archive/onigd2_4_0.tar.gz">2.4.0</a> (2004/12/01) -<li> <a href="archive/onigd2_3_3.tar.gz">2.3.3</a> (2004/10/30) </ul> <br> @@ -86,7 +91,7 @@ It follows the BSD license in the case of the one except for it. <br> <br> -<dt><b>Documents:</b> (version 3.7.0) +<dt><b>Documents:</b> (version 3.7.1) <ul> <li> <a href="doc/RE.txt">Regular Expressions</a> <a href="doc/RE.ja.txt">(Japanese: EUC-JP)</a> @@ -162,7 +167,7 @@ and I'm thankful to Akinori MUSHA. To: "Greg A. Woods"<br> I can't send mail to you. (rejected)<br> Please set the nmatch argument of regexec() to 1, -and use Oniguruma 3.6.0 or 2.4.1.<br> +and use Oniguruma 3.7.1 or 2.4.2.<br> The nmatch argument should be array size of a pmatch.<br> But I don't know whether this problem is related to the crash that you reported. diff --git a/ext/mbstring/oniguruma/oniggnu.h b/ext/mbstring/oniguruma/oniggnu.h index 4a69515466..b203f6c8a3 100644 --- a/ext/mbstring/oniguruma/oniggnu.h +++ b/ext/mbstring/oniguruma/oniggnu.h @@ -56,47 +56,9 @@ extern "C" { #define RE_OPTION_DONT_CAPTURE_GROUP ONIG_OPTION_DONT_CAPTURE_GROUP #define RE_OPTION_CAPTURE_GROUP ONIG_OPTION_CAPTURE_GROUP -#ifdef RUBY_PLATFORM -#ifndef ONIG_RUBY_M17N - -ONIG_EXTERN OnigEncoding OnigEncDefaultCharEncoding; - -#undef ismbchar -#define ismbchar(c) (mbclen((c)) != 1) -#define mbclen(c) \ - ONIGENC_MBC_ENC_LEN(OnigEncDefaultCharEncoding, (UChar* )(&c)) - -#endif /* ifndef ONIG_RUBY_M17N */ - -#define re_mbcinit ruby_re_mbcinit -#define re_compile_pattern ruby_re_compile_pattern -#define re_recompile_pattern ruby_re_recompile_pattern -#define re_free_pattern ruby_re_free_pattern -#define re_adjust_startpos ruby_re_adjust_startpos -#define re_search ruby_re_search -#define re_match ruby_re_match -#define re_set_casetable ruby_re_set_casetable -#define re_copy_registers ruby_re_copy_registers -#define re_free_registers ruby_re_free_registers -#define register_info_type ruby_register_info_type -#define re_error_code_to_str ruby_error_code_to_str - -#define ruby_error_code_to_str onig_error_code_to_str -#define ruby_re_copy_registers onig_region_copy -#else -#define re_error_code_to_str onig_error_code_to_str -#define re_copy_registers onig_region_copy -#endif - -#ifdef ONIG_RUBY_M17N -ONIG_EXTERN -void re_mbcinit P_((OnigEncoding)); -#else ONIG_EXTERN void re_mbcinit P_((int)); -#endif - ONIG_EXTERN int re_compile_pattern P_((const char*, int, struct re_pattern_buffer*, char* err_buf)); ONIG_EXTERN diff --git a/ext/mbstring/oniguruma/oniguruma.h b/ext/mbstring/oniguruma/oniguruma.h index 2106774f71..2790356108 100644 --- a/ext/mbstring/oniguruma/oniguruma.h +++ b/ext/mbstring/oniguruma/oniguruma.h @@ -38,7 +38,7 @@ extern "C" { #define ONIGURUMA #define ONIGURUMA_VERSION_MAJOR 3 #define ONIGURUMA_VERSION_MINOR 7 -#define ONIGURUMA_VERSION_TEENY 0 +#define ONIGURUMA_VERSION_TEENY 1 #ifdef __cplusplus # ifndef HAVE_PROTOTYPES @@ -81,7 +81,11 @@ extern "C" { /* PART: character encoding */ -typedef unsigned char UChar; +#ifndef ONIG_ESCAPE_UCHAR_COLLISION +#define UChar OnigUChar +#endif + +typedef unsigned char OnigUChar; typedef unsigned long OnigCodePoint; typedef unsigned int OnigDistance; @@ -151,24 +155,24 @@ typedef m17n_encoding* OnigEncoding; #else typedef struct { - int (*mbc_enc_len)(const UChar* p); + int (*mbc_enc_len)(const OnigUChar* p); const char* name; int max_enc_len; int min_enc_len; OnigAmbigType support_ambig_flag; OnigMetaCharTableType meta_char_table; - int (*is_mbc_newline)(const UChar* p, const UChar* end); - OnigCodePoint (*mbc_to_code)(const UChar* p, const UChar* end); + int (*is_mbc_newline)(const OnigUChar* p, const OnigUChar* end); + OnigCodePoint (*mbc_to_code)(const OnigUChar* p, const OnigUChar* end); int (*code_to_mbclen)(OnigCodePoint code); - int (*code_to_mbc)(OnigCodePoint code, UChar *buf); - int (*mbc_to_normalize)(OnigAmbigType flag, const UChar** pp, const UChar* end, UChar* to); - int (*is_mbc_ambiguous)(OnigAmbigType flag, const UChar** pp, const UChar* end); + int (*code_to_mbc)(OnigCodePoint code, OnigUChar *buf); + int (*mbc_to_normalize)(OnigAmbigType flag, const OnigUChar** pp, const OnigUChar* end, OnigUChar* to); + int (*is_mbc_ambiguous)(OnigAmbigType flag, const OnigUChar** pp, const OnigUChar* end); int (*get_all_pair_ambig_codes)(OnigAmbigType flag, OnigPairAmbigCodes** acs); int (*get_all_comp_ambig_codes)(OnigAmbigType flag, OnigCompAmbigCodes** acs); int (*is_code_ctype)(OnigCodePoint code, unsigned int ctype); int (*get_ctype_code_range)(int ctype, OnigCodePoint* sb_range[], OnigCodePoint* mb_range[]); - UChar* (*left_adjust_char_head)(const UChar* start, const UChar* p); - int (*is_allowed_reverse_match)(const UChar* p, const UChar* end); + OnigUChar* (*left_adjust_char_head)(const OnigUChar* start, const OnigUChar* p); + int (*is_allowed_reverse_match)(const OnigUChar* p, const OnigUChar* end); } OnigEncodingType; typedef OnigEncodingType* OnigEncoding; @@ -335,22 +339,22 @@ ONIG_EXTERN OnigEncodingType OnigEncodingBIG5; ONIG_EXTERN int onigenc_is_code_ctype P_((OnigEncoding enc, OnigCodePoint code, int ctype)); ONIG_EXTERN -int onigenc_code_to_mbc P_((OnigEncoding enc, OnigCodePoint code, UChar *buf)); +int onigenc_code_to_mbc P_((OnigEncoding enc, OnigCodePoint code, OnigUChar *buf)); ONIG_EXTERN -int onigenc_mbc_to_normalize P_((OnigEncoding enc, OnigAmbigType flag, const UChar** pp, const UChar* end, UChar* buf)); +int onigenc_mbc_to_normalize P_((OnigEncoding enc, OnigAmbigType flag, const OnigUChar** pp, const OnigUChar* end, OnigUChar* buf)); ONIG_EXTERN -int onigenc_is_mbc_ambiguous P_((OnigEncoding enc, OnigAmbigType flag, const UChar** pp, const UChar* end)); +int onigenc_is_mbc_ambiguous P_((OnigEncoding enc, OnigAmbigType flag, const OnigUChar** pp, const OnigUChar* end)); ONIG_EXTERN -int onigenc_is_allowed_reverse_match P_((OnigEncoding enc, const UChar* s, const UChar* end)); +int onigenc_is_allowed_reverse_match P_((OnigEncoding enc, const OnigUChar* s, const OnigUChar* end)); #else /* ONIG_RUBY_M17N */ #define ONIGENC_NAME(enc) ((enc)->name) #define ONIGENC_MBC_TO_NORMALIZE(enc,flag,pp,end,buf) \ - (enc)->mbc_to_normalize(flag,(const UChar** )pp,end,buf) + (enc)->mbc_to_normalize(flag,(const OnigUChar** )pp,end,buf) #define ONIGENC_IS_MBC_AMBIGUOUS(enc,flag,pp,end) \ - (enc)->is_mbc_ambiguous(flag,(const UChar** )pp,end) + (enc)->is_mbc_ambiguous(flag,(const OnigUChar** )pp,end) #define ONIGENC_SUPPORT_AMBIG_FLAG(enc) ((enc)->support_ambig_flag) #define ONIGENC_IS_ALLOWED_REVERSE_MATCH(enc,s,end) \ (enc)->is_allowed_reverse_match(s,end) @@ -407,7 +411,7 @@ int onigenc_is_allowed_reverse_match P_((OnigEncoding enc, const UChar* s, const (enc)->get_ctype_code_range(ctype,sbr,mbr) ONIG_EXTERN -UChar* onigenc_step_back P_((OnigEncoding enc, const UChar* start, const UChar* s, int n)); +OnigUChar* onigenc_step_back P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s, int n)); #endif /* is not ONIG_RUBY_M17N */ @@ -420,21 +424,21 @@ int onigenc_set_default_encoding P_((OnigEncoding enc)); ONIG_EXTERN OnigEncoding onigenc_get_default_encoding P_(()); ONIG_EXTERN -void onigenc_set_default_caseconv_table P_((const UChar* table)); +void onigenc_set_default_caseconv_table P_((const OnigUChar* table)); ONIG_EXTERN -UChar* onigenc_get_right_adjust_char_head_with_prev P_((OnigEncoding enc, const UChar* start, const UChar* s, const UChar** prev)); +OnigUChar* onigenc_get_right_adjust_char_head_with_prev P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s, const OnigUChar** prev)); ONIG_EXTERN -UChar* onigenc_get_prev_char_head P_((OnigEncoding enc, const UChar* start, const UChar* s)); +OnigUChar* onigenc_get_prev_char_head P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s)); ONIG_EXTERN -UChar* onigenc_get_left_adjust_char_head P_((OnigEncoding enc, const UChar* start, const UChar* s)); +OnigUChar* onigenc_get_left_adjust_char_head P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s)); ONIG_EXTERN -UChar* onigenc_get_right_adjust_char_head P_((OnigEncoding enc, const UChar* start, const UChar* s)); +OnigUChar* onigenc_get_right_adjust_char_head P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s)); ONIG_EXTERN -int onigenc_strlen P_((OnigEncoding enc, const UChar* p, const UChar* end)); +int onigenc_strlen P_((OnigEncoding enc, const OnigUChar* p, const OnigUChar* end)); ONIG_EXTERN -int onigenc_strlen_null P_((OnigEncoding enc, const UChar* p)); +int onigenc_strlen_null P_((OnigEncoding enc, const OnigUChar* p)); ONIG_EXTERN -int onigenc_str_bytelen_null P_((OnigEncoding enc, const UChar* p)); +int onigenc_str_bytelen_null P_((OnigEncoding enc, const OnigUChar* p)); @@ -697,8 +701,8 @@ struct re_registers { typedef struct re_registers OnigRegion; typedef struct { - UChar* par; - UChar* par_end; + OnigUChar* par; + OnigUChar* par_end; } OnigErrorInfo; typedef struct { @@ -778,25 +782,25 @@ typedef struct { ONIG_EXTERN int onig_init P_((void)); ONIG_EXTERN -int onig_error_code_to_str PV_((UChar* s, int err_code, ...)); +int onig_error_code_to_str PV_((OnigUChar* s, int err_code, ...)); ONIG_EXTERN void onig_set_warn_func P_((OnigWarnFunc f)); ONIG_EXTERN void onig_set_verb_warn_func P_((OnigWarnFunc f)); ONIG_EXTERN -int onig_new P_((regex_t**, const UChar* pattern, const UChar* pattern_end, OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax, OnigErrorInfo* einfo)); +int onig_new P_((regex_t**, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax, OnigErrorInfo* einfo)); ONIG_EXTERN -int onig_new_deluxe P_((regex_t** reg, const UChar* pattern, const UChar* pattern_end, OnigCompileInfo* ci, OnigErrorInfo* einfo)); +int onig_new_deluxe P_((regex_t** reg, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigCompileInfo* ci, OnigErrorInfo* einfo)); ONIG_EXTERN void onig_free P_((regex_t*)); ONIG_EXTERN -int onig_recompile P_((regex_t*, const UChar* pattern, const UChar* pattern_end, OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax, OnigErrorInfo* einfo)); +int onig_recompile P_((regex_t*, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax, OnigErrorInfo* einfo)); ONIG_EXTERN -int onig_recompile_deluxe P_((regex_t* reg, const UChar* pattern, const UChar* pattern_end, OnigCompileInfo* ci, OnigErrorInfo* einfo)); +int onig_recompile_deluxe P_((regex_t* reg, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigCompileInfo* ci, OnigErrorInfo* einfo)); ONIG_EXTERN -int onig_search P_((regex_t*, const UChar* str, const UChar* end, const UChar* start, const UChar* range, OnigRegion* region, OnigOptionType option)); +int onig_search P_((regex_t*, const OnigUChar* str, const OnigUChar* end, const OnigUChar* start, const OnigUChar* range, OnigRegion* region, OnigOptionType option)); ONIG_EXTERN -int onig_match P_((regex_t*, const UChar* str, const UChar* end, const UChar* at, OnigRegion* region, OnigOptionType option)); +int onig_match P_((regex_t*, const OnigUChar* str, const OnigUChar* end, const OnigUChar* at, OnigRegion* region, OnigOptionType option)); ONIG_EXTERN OnigRegion* onig_region_new P_((void)); ONIG_EXTERN @@ -812,11 +816,11 @@ int onig_region_resize P_((OnigRegion* region, int n)); ONIG_EXTERN int onig_region_set P_((OnigRegion* region, int at, int beg, int end)); ONIG_EXTERN -int onig_name_to_group_numbers P_((regex_t* reg, const UChar* name, const UChar* name_end, int** nums)); +int onig_name_to_group_numbers P_((regex_t* reg, const OnigUChar* name, const OnigUChar* name_end, int** nums)); ONIG_EXTERN -int onig_name_to_backref_number P_((regex_t* reg, const UChar* name, const UChar* name_end, OnigRegion *region)); +int onig_name_to_backref_number P_((regex_t* reg, const OnigUChar* name, const OnigUChar* name_end, OnigRegion *region)); ONIG_EXTERN -int onig_foreach_name P_((regex_t* reg, int (*func)(const UChar*, const UChar*,int,int*,regex_t*,void*), void* arg)); +int onig_foreach_name P_((regex_t* reg, int (*func)(const OnigUChar*, const OnigUChar*,int,int*,regex_t*,void*), void* arg)); ONIG_EXTERN int onig_number_of_names P_((regex_t* reg)); ONIG_EXTERN diff --git a/ext/mbstring/oniguruma/regcomp.c b/ext/mbstring/oniguruma/regcomp.c index 5171b15a36..a2315fcec5 100644 --- a/ext/mbstring/oniguruma/regcomp.c +++ b/ext/mbstring/oniguruma/regcomp.c @@ -3339,7 +3339,6 @@ typedef struct { typedef struct { MinMaxLen mmd; - BitStatusType backrefed_status; OnigEncoding enc; OnigOptionType options; OnigAmbigType ambig_flag; @@ -4271,7 +4270,7 @@ optimize_node_left(Node* node, NodeOptInfo* opt, OptEnv* env) r = optimize_node_left(en->target, opt, env); if (is_set_opt_anc_info(&opt->anc, ANCHOR_ANYCHAR_STAR_MASK)) { - if (BIT_STATUS_AT(env->backrefed_status, en->regnum)) + if (BIT_STATUS_AT(env->scan_env->backrefed_mem, en->regnum)) remove_opt_anc_info(&opt->anc, ANCHOR_ANYCHAR_STAR_MASK); } } diff --git a/ext/mbstring/oniguruma/regexec.c b/ext/mbstring/oniguruma/regexec.c index 2c082de423..25d97773fb 100644 --- a/ext/mbstring/oniguruma/regexec.c +++ b/ext/mbstring/oniguruma/regexec.c @@ -3354,8 +3354,11 @@ onig_search(regex_t* reg, const UChar* str, const UChar* end, if (sch_range > end) sch_range = (UChar* )end; } } - if (reg->dmax != ONIG_INFINITE_DISTANCE && - (end - start) >= reg->threshold_len) { + + if ((end - start) < reg->threshold_len) + goto mismatch; + + if (reg->dmax != ONIG_INFINITE_DISTANCE) { do { if (! forward_search_range(reg, str, end, s, sch_range, &low, &high, &low_prev)) goto mismatch; @@ -3368,22 +3371,26 @@ onig_search(regex_t* reg, const UChar* str, const UChar* end, prev = s; s += enc_len(reg->enc, s); } - if ((reg->anchor & ANCHOR_ANYCHAR_STAR) != 0) { - if (IS_NOT_NULL(prev)) { - while (!ONIGENC_IS_MBC_NEWLINE(reg->enc, prev, end) && - s < range) { - prev = s; - s += enc_len(reg->enc, s); - } - } - } } while (s < range); goto mismatch; } else { /* check only. */ - if ((end - start) < reg->threshold_len || - ! forward_search_range(reg, str, end, s, sch_range, + if (! forward_search_range(reg, str, end, s, sch_range, &low, &high, (UChar** )NULL)) goto mismatch; + + if ((reg->anchor & ANCHOR_ANYCHAR_STAR) != 0) { + do { + MATCH_AND_RETURN_CHECK; + prev = s; + s += enc_len(reg->enc, s); + + while (!ONIGENC_IS_MBC_NEWLINE(reg->enc, prev, end) && s < range) { + prev = s; + s += enc_len(reg->enc, s); + } + } while (s < range); + goto mismatch; + } } } diff --git a/ext/mbstring/oniguruma/reggnu.c b/ext/mbstring/oniguruma/reggnu.c index 2c8169c481..70e8582ff2 100644 --- a/ext/mbstring/oniguruma/reggnu.c +++ b/ext/mbstring/oniguruma/reggnu.c @@ -29,7 +29,7 @@ #include "regint.h" -#ifndef ONIGGNU_H /* name changes from oniggnu.h to regex.h in ruby. */ +#ifndef ONIGGNU_H #include "oniggnu.h" #endif diff --git a/ext/mbstring/oniguruma/regint.h b/ext/mbstring/oniguruma/regint.h index a704b0e263..2bd514b7c3 100644 --- a/ext/mbstring/oniguruma/regint.h +++ b/ext/mbstring/oniguruma/regint.h @@ -73,7 +73,7 @@ #define DEFAULT_MATCH_STACK_LIMIT_SIZE 0 /* unlimited */ /* interface to external system */ -#ifdef NOT_RUBY /* gived from Makefile */ +#ifdef NOT_RUBY /* given from Makefile */ #include "config.h" #define USE_CAPTURE_HISTORY #define USE_VARIABLE_META_CHARS diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c index 33f1ad1653..3c7db98e83 100644 --- a/ext/mbstring/php_mbregex.c +++ b/ext/mbstring/php_mbregex.c @@ -283,11 +283,11 @@ static php_mb_regex_t *php_mbregex_compile_pattern(const char *pattern, int patl int found = 0; php_mb_regex_t *retval = NULL, **rc = NULL; OnigErrorInfo err_info; - UChar err_str[ONIG_MAX_ERROR_MESSAGE_LEN]; + OnigUChar err_str[ONIG_MAX_ERROR_MESSAGE_LEN]; found = zend_hash_find(&MBSTRG(ht_rc), (char *)pattern, patlen+1, (void **) &rc); if (found == FAILURE || (*rc)->options != options || (*rc)->enc != enc || (*rc)->syntax != syntax) { - if ((err_code = onig_new(&retval, (UChar *)pattern, (UChar *)(pattern + patlen), options, enc, syntax, &err_info)) != ONIG_NORMAL) { + if ((err_code = onig_new(&retval, (OnigUChar *)pattern, (OnigUChar *)(pattern + patlen), options, enc, syntax, &err_info)) != ONIG_NORMAL) { onig_error_code_to_str(err_str, err_code, err_info); php_error_docref(NULL TSRMLS_CC, E_WARNING, "mbregex compile err: %s", err_str); retval = NULL; @@ -559,7 +559,7 @@ static void _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase) regs = onig_region_new(); /* actually execute the regular expression */ - if (onig_search(re, (UChar *)string, (UChar *)(string + string_len), string, (UChar *)(string + string_len), regs, 0) < 0) { + if (onig_search(re, (OnigUChar *)string, (OnigUChar *)(string + string_len), string, (OnigUChar *)(string + string_len), regs, 0) < 0) { RETVAL_FALSE; goto out; } @@ -634,8 +634,8 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp smart_str eval_buf = { 0 }; smart_str *pbuf; int i, err, eval, n; - UChar *pos; - UChar *string_lim; + OnigUChar *pos; + OnigUChar *string_lim; char *description = NULL; char pat_buf[2]; @@ -699,12 +699,12 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp /* do the actual work */ err = 0; pos = string; - string_lim = (UChar*)(string + string_len); + string_lim = (OnigUChar*)(string + string_len); regs = onig_region_new(); while (err >= 0) { - err = onig_search(re, (UChar *)string, (UChar *)string_lim, pos, (UChar *)string_lim, regs, 0); + err = onig_search(re, (OnigUChar *)string, (OnigUChar *)string_lim, pos, (OnigUChar *)string_lim, regs, 0); if (err <= -2) { - UChar err_str[ONIG_MAX_ERROR_MESSAGE_LEN]; + OnigUChar err_str[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str(err_str, err); php_error_docref(NULL TSRMLS_CC, E_WARNING, "mbregex search failure in php_mbereg_replace_exec(): %s", err_str); break; @@ -717,7 +717,7 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp } #endif /* copy the part of the string before the match */ - smart_str_appendl(&out_buf, pos, (size_t)((UChar *)(string + regs->beg[0]) - pos)); + smart_str_appendl(&out_buf, pos, (size_t)((OnigUChar *)(string + regs->beg[0]) - pos)); /* copy replacement and backrefs */ i = 0; p = replace; @@ -754,7 +754,7 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp zval_dtor(&v); } n = regs->end[0]; - if ((size_t)(pos - (UChar *)string) < n) { + if ((size_t)(pos - (OnigUChar *)string) < n) { pos = string + n; } else { if (pos < string_lim) { @@ -814,7 +814,7 @@ PHP_FUNCTION(mb_split) php_mb_regex_t *re; OnigRegion *regs = NULL; char *string; - UChar *pos; + OnigUChar *pos; int string_len; int n, err; @@ -835,28 +835,28 @@ PHP_FUNCTION(mb_split) array_init(return_value); - pos = (UChar *)string; + pos = (OnigUChar *)string; err = 0; regs = onig_region_new(); /* churn through str, generating array entries as we go */ while ((--count != 0) && - (err = onig_search(re, (UChar *)string, (UChar *)(string + string_len), pos, (UChar *)(string + string_len), regs, 0)) >= 0) { + (err = onig_search(re, (OnigUChar *)string, (OnigUChar *)(string + string_len), pos, (OnigUChar *)(string + string_len), regs, 0)) >= 0) { if (regs->beg[0] == regs->end[0]) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty regular expression"); break; } /* add it to the array */ - if (regs->beg[0] < string_len && regs->beg[0] >= (size_t)(pos - (UChar *)string)) { - add_next_index_stringl(return_value, pos, ((UChar *)(string + regs->beg[0]) - pos), 1); + if (regs->beg[0] < string_len && regs->beg[0] >= (size_t)(pos - (OnigUChar *)string)) { + add_next_index_stringl(return_value, pos, ((OnigUChar *)(string + regs->beg[0]) - pos), 1); } else { err = -2; break; } /* point at our new starting point */ n = regs->end[0]; - if ((pos - (UChar *)string) < n) { - pos = (UChar *)string + n; + if ((pos - (OnigUChar *)string) < n) { + pos = (OnigUChar *)string + n; } if (count < 0) { count = 0; @@ -868,7 +868,7 @@ PHP_FUNCTION(mb_split) /* see if we encountered an error */ if (err <= -2) { - UChar err_str[ONIG_MAX_ERROR_MESSAGE_LEN]; + OnigUChar err_str[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str(err_str, err); php_error_docref(NULL TSRMLS_CC, E_WARNING, "mbregex search failure in mbsplit(): %s", err_str); zval_dtor(return_value); @@ -876,7 +876,7 @@ PHP_FUNCTION(mb_split) } /* otherwise we just have one last element to add to the array */ - n = ((UChar *)(string + string_len) - pos); + n = ((OnigUChar *)(string + string_len) - pos); if (n > 0) { add_next_index_stringl(return_value, pos, n, 1); } else { @@ -922,7 +922,7 @@ PHP_FUNCTION(mb_ereg_match) } /* match */ - err = onig_match(re, (UChar *)string, (UChar *)(string + string_len), (UChar *)string, NULL, 0); + err = onig_match(re, (OnigUChar *)string, (OnigUChar *)(string + string_len), (OnigUChar *)string, NULL, 0); if (err >= 0) { RETVAL_TRUE; } else { @@ -938,7 +938,7 @@ _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mode) { zval **arg_pattern, **arg_options; int n, i, err, pos, len, beg, end, option; - UChar *str; + OnigUChar *str; OnigSyntaxType *syntax; option = MBSTRG(regex_default_options); @@ -975,7 +975,7 @@ _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mode) str = NULL; len = 0; if (MBSTRG(search_str) != NULL && Z_TYPE_P(MBSTRG(search_str)) == IS_STRING){ - str = (UChar *)Z_STRVAL_P(MBSTRG(search_str)); + str = (OnigUChar *)Z_STRVAL_P(MBSTRG(search_str)); len = Z_STRLEN_P(MBSTRG(search_str)); } @@ -999,7 +999,7 @@ _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mode) MBSTRG(search_pos) = len; RETVAL_FALSE; } else if (err <= -2) { - UChar err_str[ONIG_MAX_ERROR_MESSAGE_LEN]; + OnigUChar err_str[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str(err_str, err); php_error_docref(NULL TSRMLS_CC, E_WARNING, "mbregex search failure in mbregex_search(): %s", err_str); RETVAL_FALSE; @@ -1138,12 +1138,12 @@ PHP_FUNCTION(mb_ereg_search_init) PHP_FUNCTION(mb_ereg_search_getregs) { int n, i, len, beg, end; - UChar *str; + OnigUChar *str; if (MBSTRG(search_regs) != NULL && Z_TYPE_P(MBSTRG(search_str)) == IS_STRING && Z_STRVAL_P(MBSTRG(search_str)) != NULL) { array_init(return_value); - str = (UChar *)Z_STRVAL_P(MBSTRG(search_str)); + str = (OnigUChar *)Z_STRVAL_P(MBSTRG(search_str)); len = Z_STRLEN_P(MBSTRG(search_str)); n = MBSTRG(search_regs)->num_regs; for (i = 0; i < n; i++) { |