summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-29 02:20:23 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-29 02:20:23 +0000
commit7fc16c237724a5f4377cea47e3434f53d42af5f4 (patch)
treef617167d6c1cedde26b8ad9a083cbbb7f61717bd /string.c
parentd2d37173e7803d6ceec22233a903eb26e0617151 (diff)
* encoding.c (rb_enc_compatible): ASCII compatible string and US-ASCII
regexp is compatible. [ruby-dev:36033] * string.c (rb_str_index_m): second argument is position of character. by usa. [ruby-dev:36033] * string.c (rb_str_rindex_m): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/string.c b/string.c
index 26b57b5e3b..180d869acd 100644
--- a/string.c
+++ b/string.c
@@ -2167,6 +2167,9 @@ rb_str_index_m(int argc, VALUE *argv, VALUE str)
}
}
+ pos = str_offset(RSTRING_PTR(str), RSTRING_END(str), pos,
+ rb_enc_check(str, sub), single_byte_optimizable(str));
+
switch (TYPE(sub)) {
case T_REGEXP:
pos = rb_reg_adjust_startpos(sub, str, pos, 0);
@@ -2277,6 +2280,9 @@ rb_str_rindex_m(int argc, VALUE *argv, VALUE str)
pos = len;
}
+ pos = str_offset(RSTRING_PTR(str), RSTRING_END(str), pos,
+ rb_enc_check(str, sub), single_byte_optimizable(str));
+
switch (TYPE(sub)) {
case T_REGEXP:
/* enc = rb_get_check(str, sub); */