From 2cb6c2778134575e425cd5d1bdef036100a25d0d Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Tue, 22 Sep 2015 19:10:03 +0900 Subject: String#index should no longer take integer argument --- mrblib/string.rb | 2 +- src/string.c | 11 ----------- 2 files changed, 1 insertion(+), 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