summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-30 16:18:27 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-30 16:18:27 +0000
commit66880e05aab3036164e8084d294ae2683b4c9e1d (patch)
tree25c921d05d807c94b402607ca96d42b7e1c183df
parentde81a536ca08842bd5414fcd64f7621eb73bd4bb (diff)
downloadruby-66880e05aab3036164e8084d294ae2683b4c9e1d.tar.gz
ruby-66880e05aab3036164e8084d294ae2683b4c9e1d.tar.xz
ruby-66880e05aab3036164e8084d294ae2683b4c9e1d.zip
* string.c (rb_str_split_m): should use rb_str_subseq() which use
offset and length by bytes. [ruby-dev:36641] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19649 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--string.c4
2 files changed, 7 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index f6526f250..4ea3f8f64 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/string.c b/string.c
index 6a6859b1f..06bb26caa 100644
--- a/string.c
+++ b/string.c
@@ -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;
}