mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* string.c (rb_str_index_m): only regexp uses byte offset.
* string.c (rb_str_rindex_m): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18919 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
100d0a568e
commit
56c3432476
2 changed files with 12 additions and 6 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Fri Aug 29 18:20:56 2008 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
|
* string.c (rb_str_index_m): only regexp uses byte offset.
|
||||||
|
|
||||||
|
* string.c (rb_str_rindex_m): ditto.
|
||||||
|
|
||||||
Fri Aug 29 16:48:34 2008 Koichi Sasada <ko1@atdot.net>
|
Fri Aug 29 16:48:34 2008 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
* vm_insnhelper.c (vm_call_method): copy arguments to allocated
|
* vm_insnhelper.c (vm_call_method): copy arguments to allocated
|
||||||
|
|
12
string.c
12
string.c
|
@ -2167,11 +2167,11 @@ 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)) {
|
switch (TYPE(sub)) {
|
||||||
case T_REGEXP:
|
case T_REGEXP:
|
||||||
|
pos = str_offset(RSTRING_PTR(str), RSTRING_END(str), pos,
|
||||||
|
rb_enc_check(str, sub), single_byte_optimizable(str));
|
||||||
|
|
||||||
pos = rb_reg_adjust_startpos(sub, str, pos, 0);
|
pos = rb_reg_adjust_startpos(sub, str, pos, 0);
|
||||||
pos = rb_reg_search(sub, str, pos, 0);
|
pos = rb_reg_search(sub, str, pos, 0);
|
||||||
pos = rb_str_sublen(str, pos);
|
pos = rb_str_sublen(str, pos);
|
||||||
|
@ -2280,12 +2280,12 @@ rb_str_rindex_m(int argc, VALUE *argv, VALUE str)
|
||||||
pos = len;
|
pos = len;
|
||||||
}
|
}
|
||||||
|
|
||||||
pos = str_offset(RSTRING_PTR(str), RSTRING_END(str), pos,
|
|
||||||
rb_enc_check(str, sub), single_byte_optimizable(str));
|
|
||||||
|
|
||||||
switch (TYPE(sub)) {
|
switch (TYPE(sub)) {
|
||||||
case T_REGEXP:
|
case T_REGEXP:
|
||||||
/* enc = rb_get_check(str, sub); */
|
/* enc = rb_get_check(str, sub); */
|
||||||
|
pos = str_offset(RSTRING_PTR(str), RSTRING_END(str), pos,
|
||||||
|
rb_enc_check(str, sub), single_byte_optimizable(str));
|
||||||
|
|
||||||
if (!RREGEXP(sub)->ptr || RREGEXP_SRC_LEN(sub)) {
|
if (!RREGEXP(sub)->ptr || RREGEXP_SRC_LEN(sub)) {
|
||||||
pos = rb_reg_adjust_startpos(sub, str, pos, 1);
|
pos = rb_reg_adjust_startpos(sub, str, pos, 1);
|
||||||
pos = rb_reg_search(sub, str, pos, 1);
|
pos = rb_reg_search(sub, str, pos, 1);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue