summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/string.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/string.c b/src/string.c
index 84f33024e..a0d75f544 100644
--- a/src/string.c
+++ b/src/string.c
@@ -1591,8 +1591,7 @@ mrb_str_index(mrb_state *mrb, mrb_value str)
mrb_get_args(mrb, "*", &argv, &argc);
if (argc == 2) {
- pos = mrb_fixnum(argv[1]);
- sub = argv[0];
+ mrb_get_args(mrb, "oi", &sub, &pos);
}
else {
pos = 0;
@@ -1857,14 +1856,11 @@ mrb_str_rindex(mrb_state *mrb, mrb_value str)
mrb_value *argv;
mrb_int argc;
mrb_value sub;
- mrb_value vpos;
mrb_int pos, len = RSTRING_CHAR_LEN(str);
mrb_get_args(mrb, "*", &argv, &argc);
if (argc == 2) {
- sub = argv[0];
- vpos = argv[1];
- pos = mrb_fixnum(vpos);
+ mrb_get_args(mrb, "oi", &sub, &pos);
if (pos < 0) {
pos += len;
if (pos < 0) {