1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* string.c (rb_str_split_m): should use rb_str_subseq() which use

offset and length by bytes.  [ruby-dev:36641]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19649 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2008-09-30 16:18:27 +00:00
parent a75eadef3b
commit d370a79c69
2 changed files with 7 additions and 2 deletions

View file

@ -1,3 +1,8 @@
Wed Oct 1 00:54:32 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* string.c (rb_str_split_m): should use rb_str_subseq() which use
offset and length by bytes. [ruby-dev:36641]
Wed Oct 1 00:29:48 2008 Yusuke Endoh <mame@tsg.ne.jp>
* test/ruby/test_settracefunc.rb (test_call, test_class): line number

View file

@ -5148,7 +5148,7 @@ rb_str_split_m(int argc, VALUE *argv, VALUE str)
spat = rb_reg_regcomp(spat);
split_type = regexp;
}
else if (rb_enc_mbminlen(enc2) == 1) {
else if (rb_enc_asciicompat(enc2) == 1) {
if (RSTRING_LEN(spat) == 1 && RSTRING_PTR(spat)[0] == ' '){
split_type = awk;
}
@ -5224,7 +5224,7 @@ rb_str_split_m(int argc, VALUE *argv, VALUE str)
ptr = t;
continue;
}
rb_ary_push(result, rb_str_substr(str, ptr - RSTRING_PTR(str), end));
rb_ary_push(result, rb_str_subseq(str, ptr - RSTRING_PTR(str), end));
ptr += end + slen;
if (!NIL_P(limit) && lim <= ++i) break;
}