summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2015-09-23 01:06:11 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2015-09-23 01:06:26 +0900
commit6a06a3e48d4fbe55698eb285e48ffaf58385fe3b (patch)
tree6fe39b540d6c050ae5d67fd3b8c3e1e0de78cb1b
parent418eec2c7d14197b3fac80957f6d45c92dd80942 (diff)
downloadmruby-6a06a3e48d4fbe55698eb285e48ffaf58385fe3b.tar.gz
mruby-6a06a3e48d4fbe55698eb285e48ffaf58385fe3b.zip
String#rindex should no longer take integer argument
-rw-r--r--src/string.c10
-rw-r--r--test/t/string.rb3
2 files changed, 0 insertions, 13 deletions
diff --git a/src/string.c b/src/string.c
index e7049d678..031429e38 100644
--- a/src/string.c
+++ b/src/string.c
@@ -1725,16 +1725,6 @@ mrb_str_rindex_m(mrb_state *mrb, mrb_value str)
mrb_regexp_check(mrb, sub);
switch (mrb_type(sub)) {
- case MRB_TT_FIXNUM: {
- mrb_int c = mrb_fixnum(sub);
- unsigned char *p = (unsigned char*)RSTRING_PTR(str);
-
- for (pos=len-1;pos>=0;pos--) {
- if (p[pos] == c) return mrb_fixnum_value(pos);
- }
- return mrb_nil_value();
- }
-
default: {
mrb_value tmp;
diff --git a/test/t/string.rb b/test/t/string.rb
index 87aec0e21..f9aed341c 100644
--- a/test/t/string.rb
+++ b/test/t/string.rb
@@ -424,9 +424,6 @@ assert('String#rindex', '15.2.10.5.31') do
assert_nil 'abc'.rindex('d')
assert_equal 0, 'abcabc'.rindex('a', 1)
assert_equal 3, 'abcabc'.rindex('a', 4)
-
- assert_equal 3, 'abcabc'.rindex(97)
- assert_equal nil, 'abcabc'.rindex(0)
end
# 'String#scan', '15.2.10.5.32' will be tested in mrbgems.