summaryrefslogtreecommitdiffstats
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
commit9a112b9ec28887185867fdc3e048f4f43d556f29 (patch)
treef617167d6c1cedde26b8ad9a083cbbb7f61717bd /string.c
parent041116d94c4357564a362b4c2250abc3e869ba64 (diff)
downloadruby-9a112b9ec28887185867fdc3e048f4f43d556f29.tar.gz
ruby-9a112b9ec28887185867fdc3e048f4f43d556f29.tar.xz
ruby-9a112b9ec28887185867fdc3e048f4f43d556f29.zip
* 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: http://svn.ruby-lang.org/repos/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 26b57b5e3..180d869ac 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); */