String#index should no longer take integer argument

parent e47f0fc0
......@@ -12,7 +12,7 @@ class String
def each_line(&block)
# expect that str.index accepts an Integer for 1st argument as a byte data
offset = 0
while pos = self.index(0x0a, offset)
while pos = self.index("\n", offset)
block.call(self[offset, pos + 1 - offset])
offset = pos + 1
end
......
......@@ -1389,17 +1389,6 @@ mrb_str_index_m(mrb_state *mrb, mrb_value str)
}
switch (mrb_type(sub)) {
case MRB_TT_FIXNUM: {
mrb_int c = mrb_fixnum(sub);
mrb_int len = RSTRING_LEN(str);
unsigned char *p = (unsigned char*)RSTRING_PTR(str);
for (;pos<len;pos++) {
if (p[pos] == c) return mrb_fixnum_value(pos);
}
return mrb_nil_value();
}
default: {
mrb_value tmp;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment