ruby-changes:12354
From: yugui <ko1@a...>
Date: Sun, 12 Jul 2009 23:46:02 +0900 (JST)
Subject: [ruby-changes:12354] Ruby:r24049 (ruby_1_9_1): merges r23916 from trunk into ruby_1_9_1.
yugui 2009-07-12 23:45:43 +0900 (Sun, 12 Jul 2009) New Revision: 24049 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=24049 Log: merges r23916 from trunk into ruby_1_9_1. -- * re.c (reg_match_pos): adjust offset based on characters, not bytes. [ruby-dev:38722] * string.c (rb_str_offset): new function. * string.c (rb_str_index_m): no call to rb_reg_adjust_startpos(). Modified files: branches/ruby_1_9_1/ChangeLog branches/ruby_1_9_1/include/ruby/intern.h branches/ruby_1_9_1/re.c branches/ruby_1_9_1/string.c branches/ruby_1_9_1/version.h Index: ruby_1_9_1/include/ruby/intern.h =================================================================== --- ruby_1_9_1/include/ruby/intern.h (revision 24048) +++ ruby_1_9_1/include/ruby/intern.h (revision 24049) @@ -625,6 +625,7 @@ VALUE rb_str_intern(VALUE); VALUE rb_sym_to_s(VALUE); VALUE rb_str_length(VALUE); +long rb_str_offset(VALUE, long); size_t rb_str_capacity(VALUE); #if defined __GNUC__ #define rb_str_new_cstr(str) __extension__ ( \ Index: ruby_1_9_1/ChangeLog =================================================================== --- ruby_1_9_1/ChangeLog (revision 24048) +++ ruby_1_9_1/ChangeLog (revision 24049) @@ -1,3 +1,12 @@ +Tue Jun 30 17:44:24 2009 Yukihiro Matsumoto <matz@r...> + + * re.c (reg_match_pos): adjust offset based on characters, not + bytes. [ruby-dev:38722] + + * string.c (rb_str_offset): new function. + + * string.c (rb_str_index_m): no call to rb_reg_adjust_startpos(). + Tue Jun 30 16:48:49 2009 Nobuyoshi Nakada <nobu@r...> * tool/compile_prelude.rb: use US-ASCII name. Index: ruby_1_9_1/re.c =================================================================== --- ruby_1_9_1/re.c (revision 24048) +++ ruby_1_9_1/re.c (revision 24049) @@ -2546,7 +2546,7 @@ return pos; } } - pos = rb_reg_adjust_startpos(re, str, pos, 0); + pos = rb_str_offset(str, pos); } return rb_reg_search(re, str, pos, 0); } Index: ruby_1_9_1/string.c =================================================================== --- ruby_1_9_1/string.c (revision 24048) +++ ruby_1_9_1/string.c (revision 24049) @@ -1357,6 +1357,13 @@ return pp - p; } +long +rb_str_offset(VALUE str, long pos) +{ + return str_offset(RSTRING_PTR(str), RSTRING_END(str), pos, + STR_ENC_GET(str), single_byte_optimizable(str)); +} + #ifdef NONASCII_MASK static char * str_utf8_nth(const char *p, const char *e, int nth) @@ -2372,9 +2379,8 @@ switch (TYPE(sub)) { case T_REGEXP: pos = str_offset(RSTRING_PTR(str), RSTRING_END(str), pos, - rb_enc_check(str, sub), single_byte_optimizable(str)); + rb_enc_check(str, sub), single_byte_optimizable(str)); - pos = rb_reg_adjust_startpos(sub, str, pos, 0); pos = rb_reg_search(sub, str, pos, 0); pos = rb_str_sublen(str, pos); break; @@ -2489,7 +2495,6 @@ STR_ENC_GET(str), single_byte_optimizable(str)); if (!RREGEXP(sub)->ptr || RREGEXP_SRC_LEN(sub)) { - pos = rb_reg_adjust_startpos(sub, str, pos, 1); pos = rb_reg_search(sub, str, pos, 1); pos = rb_str_sublen(str, pos); } Index: ruby_1_9_1/version.h =================================================================== --- ruby_1_9_1/version.h (revision 24048) +++ ruby_1_9_1/version.h (revision 24049) @@ -1,6 +1,6 @@ #define RUBY_VERSION "1.9.1" #define RUBY_RELEASE_DATE "2009-07-12" -#define RUBY_PATCHLEVEL 212 +#define RUBY_PATCHLEVEL 213 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/