summaryrefslogtreecommitdiffstats
path: root/string.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-03-09 18:51:46 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-03-09 18:51:46 +0000
commit95c04673589b3ceb9565d605bacf38320cb688aa (patch)
treefd0ae979c44725fea504d174fcd52aba25bdb71a /string.c
parentba164bcca3d038a0721cd9ab348d192e63da2b99 (diff)
downloadruby-95c04673589b3ceb9565d605bacf38320cb688aa.tar.gz
ruby-95c04673589b3ceb9565d605bacf38320cb688aa.tar.xz
ruby-95c04673589b3ceb9565d605bacf38320cb688aa.zip
* string.c (rb_str_index): if t == s + pos, the character beginning
from s + pos is valid. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15737 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/string.c b/string.c
index 053db6cbb..53c402792 100644
--- a/string.c
+++ b/string.c
@@ -2074,7 +2074,7 @@ rb_str_index(VALUE str, VALUE sub, long offset)
pos = rb_memsearch(sptr, slen, s, len);
if (pos < 0) return pos;
t = rb_enc_right_char_head(s, s+pos, enc);
- if (t == s) break;
+ if (t == s + pos) break;
if ((len -= t - s) <= 0) return -1;
offset += t - s;
s = t;