From 10ff0f292e9b7cd673915fcc32f5d236c95c8d7d Mon Sep 17 00:00:00 2001 From: akr Date: Sat, 13 Sep 2008 18:44:53 +0000 Subject: [PATCH] * include/ruby/oniguruma.h (ONIGENC_STEP_BACK): add end argument. (onigenc_step_back): ditto. * regenc.c (onigenc_step_back): add end argument. * regexec.c: follow the interface change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 9 +++++++++ include/ruby/oniguruma.h | 6 +++--- regenc.c | 2 +- regexec.c | 8 ++++---- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index ca86c735c1..e4a4b06706 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Sun Sep 14 03:43:27 2008 Tanaka Akira + + * include/ruby/oniguruma.h (ONIGENC_STEP_BACK): add end argument. + (onigenc_step_back): ditto. + + * regenc.c (onigenc_step_back): add end argument. + + * regexec.c: follow the interface change. + Sun Sep 14 03:20:03 2008 Tanaka Akira * include/ruby/oniguruma.h (onigenc_get_prev_char_head): add end diff --git a/include/ruby/oniguruma.h b/include/ruby/oniguruma.h index e91e3312ef..63eba4fc5d 100644 --- a/include/ruby/oniguruma.h +++ b/include/ruby/oniguruma.h @@ -225,8 +225,8 @@ ONIG_EXTERN OnigEncodingType OnigEncodingASCII; (enc)->apply_all_case_fold(case_fold_flag,f,arg,enc) #define ONIGENC_GET_CASE_FOLD_CODES_BY_STR(enc,case_fold_flag,p,end,acs) \ (enc)->get_case_fold_codes_by_str(case_fold_flag,p,end,acs,enc) -#define ONIGENC_STEP_BACK(enc,start,s,n) \ - onigenc_step_back((enc),(start),(s),(n)) +#define ONIGENC_STEP_BACK(enc,start,s,end,n) \ + onigenc_step_back((enc),(start),(s),(end),(n)) #define ONIGENC_CONSTRUCT_MBCLEN_CHARFOUND(n) (n) #define ONIGENC_MBCLEN_CHARFOUND_P(r) (0 < (r)) @@ -290,7 +290,7 @@ int onigenc_mbclen_approximate P_((const OnigUChar* p,const OnigUChar* e, struct (enc)->get_ctype_code_range(ctype,sbout,ranges,enc) ONIG_EXTERN -OnigUChar* onigenc_step_back P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s, int n)); +OnigUChar* onigenc_step_back P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s, const OnigUChar* end, int n)); /* encoding API */ diff --git a/regenc.c b/regenc.c index f31c4ffdd2..a67774e30b 100644 --- a/regenc.c +++ b/regenc.c @@ -97,7 +97,7 @@ onigenc_get_prev_char_head(OnigEncoding enc, const UChar* start, const UChar* s, } extern UChar* -onigenc_step_back(OnigEncoding enc, const UChar* start, const UChar* s, int n) +onigenc_step_back(OnigEncoding enc, const UChar* start, const UChar* s, const UChar* end, int n) { while (ONIG_IS_NOT_NULL(s) && n-- > 0) { if (s <= start) diff --git a/regexec.c b/regexec.c index 285a323eae..8941403a97 100644 --- a/regexec.c +++ b/regexec.c @@ -2647,7 +2647,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end, case OP_LOOK_BEHIND: MOP_IN(OP_LOOK_BEHIND); GET_LENGTH_INC(tlen, p); - s = (UChar* )ONIGENC_STEP_BACK(encode, str, s, (int )tlen); + s = (UChar* )ONIGENC_STEP_BACK(encode, str, s, end, (int )tlen); if (IS_NULL(s)) goto fail; sprev = (UChar* )onigenc_get_prev_char_head(encode, str, s, end); MOP_OUT; @@ -2657,7 +2657,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end, case OP_PUSH_LOOK_BEHIND_NOT: MOP_IN(OP_PUSH_LOOK_BEHIND_NOT); GET_RELADDR_INC(addr, p); GET_LENGTH_INC(tlen, p); - q = (UChar* )ONIGENC_STEP_BACK(encode, str, s, (int )tlen); + q = (UChar* )ONIGENC_STEP_BACK(encode, str, s, end, (int )tlen); if (IS_NULL(q)) { /* too short case -> success. ex. /(?anchor & ANCHOR_SEMI_END_BUF) { - UChar* pre_end = ONIGENC_STEP_BACK(reg->enc, str, end, 1); + UChar* pre_end = ONIGENC_STEP_BACK(reg->enc, str, end, end, 1); max_semi_end = (UChar* )end; if (ONIGENC_IS_MBC_NEWLINE(reg->enc, pre_end, end)) { min_semi_end = pre_end; #ifdef USE_CRNL_AS_LINE_TERMINATOR - pre_end = ONIGENC_STEP_BACK(reg->enc, str, pre_end, 1); + pre_end = ONIGENC_STEP_BACK(reg->enc, str, pre_end, end, 1); if (IS_NOT_NULL(pre_end) && ONIGENC_IS_MBC_CRNL(reg->enc, pre_end, end)) { min_semi_end = pre_end;