diff options
| author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-09-13 16:40:31 +0000 |
|---|---|---|
| committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-09-13 16:40:31 +0000 |
| commit | df2ac1e8911b04384839924e80a99c14b84ee74d (patch) | |
| tree | 0d5629d488672736c6252861e74f04a8e904e594 /string.c | |
| parent | 35010b8fc4a23254983b08ac423690437f47acb4 (diff) | |
| download | ruby-df2ac1e8911b04384839924e80a99c14b84ee74d.tar.gz ruby-df2ac1e8911b04384839924e80a99c14b84ee74d.tar.xz ruby-df2ac1e8911b04384839924e80a99c14b84ee74d.zip | |
* include/ruby/oniguruma.h (onigenc_get_right_adjust_char_head): add
end argument.
* include/ruby/encoding.h (rb_enc_right_char_head): add end argument.
* regenc.c (onigenc_get_right_adjust_char_head): use end argument.
* re.c (rb_reg_adjust_startpos): follow the interface change.
* string.c (rb_str_index): ditto.
* regexec.c (backward_search_range): ditto.
(onig_search): ditto.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
| -rw-r--r-- | string.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -2088,7 +2088,7 @@ static long rb_str_index(VALUE str, VALUE sub, long offset) { long pos; - char *s, *sptr; + char *s, *sptr, *e; long len, slen; rb_encoding *enc; @@ -2104,6 +2104,7 @@ rb_str_index(VALUE str, VALUE sub, long offset) } if (len - offset < slen) return -1; s = RSTRING_PTR(str); + e = s + RSTRING_LEN(str); if (offset) { offset = str_offset(s, RSTRING_END(str), offset, enc, single_byte_optimizable(str)); s += offset; @@ -2117,7 +2118,7 @@ rb_str_index(VALUE str, VALUE sub, long offset) char *t; pos = rb_memsearch(sptr, slen, s, len, enc); if (pos < 0) return pos; - t = rb_enc_right_char_head(s, s+pos, enc); + t = rb_enc_right_char_head(s, s+pos, e, enc); if (t == s + pos) break; if ((len -= t - s) <= 0) return -1; offset += t - s; |
