* string.c (scan_once): need no encoding compatibility check.

it's done inside of re_reg_seach().

* string.c (rb_str_split_m): ditto.

* re.c (rb_reg_regsub): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2007-12-17 09:44:06 +00:00
parent ea1b9d58b9
commit d6a70c4bb7
3 changed files with 10 additions and 5 deletions

View File

@ -1,3 +1,12 @@
Mon Dec 17 18:42:23 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* string.c (scan_once): need no encoding compatibility check.
it's done inside of re_reg_seach().
* string.c (rb_str_split_m): ditto.
* re.c (rb_reg_regsub): ditto.
Mon Dec 17 17:50:30 2007 Yukihiro Matsumoto <matz@ruby-lang.org> Mon Dec 17 17:50:30 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* string.c (rb_str_index): check if substring is broken. * string.c (rb_str_index): check if substring is broken.

1
re.c
View File

@ -2695,7 +2695,6 @@ rb_reg_regsub(VALUE str, VALUE src, struct re_registers *regs, VALUE regexp)
int no, clen; int no, clen;
rb_encoding *enc = rb_enc_check(str, src); rb_encoding *enc = rb_enc_check(str, src);
rb_enc_check(str, regexp);
p = s = RSTRING_PTR(str); p = s = RSTRING_PTR(str);
e = s + RSTRING_LEN(str); e = s + RSTRING_LEN(str);

View File

@ -4129,9 +4129,6 @@ rb_str_split_m(int argc, VALUE *argv, VALUE str)
int last_null = 0; int last_null = 0;
struct re_registers *regs; struct re_registers *regs;
if (RREGEXP(spat)->len != 0) {
enc = rb_enc_check(str, spat);
}
while ((end = rb_reg_search(spat, str, start, 0)) >= 0) { while ((end = rb_reg_search(spat, str, start, 0)) >= 0) {
regs = RMATCH(rb_backref_get())->regs; regs = RMATCH(rb_backref_get())->regs;
if (start == end && BEG(0) == END(0)) { if (start == end && BEG(0) == END(0)) {
@ -4733,7 +4730,7 @@ scan_once(VALUE str, VALUE pat, long *start)
struct re_registers *regs; struct re_registers *regs;
long i; long i;
enc = rb_enc_check(str, pat); enc = rb_enc_get(str);
if (rb_reg_search(pat, str, *start, 0) >= 0) { if (rb_reg_search(pat, str, *start, 0) >= 0) {
match = rb_backref_get(); match = rb_backref_get();
regs = RMATCH(match)->regs; regs = RMATCH(match)->regs;