mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
string.c (index,rindex) use single byte version for ASCII strings.
This commit is contained in:
@@ -1789,6 +1789,10 @@ mrb_str_byteindex_m(mrb_state *mrb, mrb_value str)
|
||||
static mrb_value
|
||||
mrb_str_index_m(mrb_state *mrb, mrb_value str)
|
||||
{
|
||||
if (RSTR_ASCII_P(mrb_str_ptr(str))) {
|
||||
return mrb_str_byteindex_m(mrb, str);
|
||||
}
|
||||
|
||||
mrb_value sub;
|
||||
mrb_int pos;
|
||||
|
||||
@@ -2056,6 +2060,10 @@ mrb_str_byterindex_m(mrb_state *mrb, mrb_value str)
|
||||
static mrb_value
|
||||
mrb_str_rindex_m(mrb_state *mrb, mrb_value str)
|
||||
{
|
||||
if (RSTR_ASCII_P(mrb_str_ptr(str))) {
|
||||
return mrb_str_byterindex_m(mrb, str);
|
||||
}
|
||||
|
||||
mrb_value sub;
|
||||
mrb_int pos;
|
||||
mrb_int len = RSTRING_CHAR_LEN(str);
|
||||
|
||||
Reference in New Issue
Block a user