diff options
| -rw-r--r-- | mrblib/string.rb | 2 | ||||
| -rw-r--r-- | src/string.c | 11 |
2 files changed, 1 insertions, 12 deletions
diff --git a/mrblib/string.rb b/mrblib/string.rb index 5765cff9b..7209f03d2 100644 --- a/mrblib/string.rb +++ b/mrblib/string.rb @@ -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 diff --git a/src/string.c b/src/string.c index 12aefa8a0..e7049d678 100644 --- a/src/string.c +++ b/src/string.c @@ -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; |
