Remove unnecessary inline function ary_elt.

And the function does not conform the naming convention anyway.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2017-08-11 12:57:37 +09:00
parent 67e2dddb82
commit ef0b239704
3 changed files with 10 additions and 15 deletions
+4 -1
View File
@@ -1074,7 +1074,10 @@ mrb_ary_entry(mrb_value ary, mrb_int offset)
if (offset < 0) {
offset += RARRAY_LEN(ary);
}
return ary_elt(ary, offset);
if (offset < 0 || RARRAY_LEN(ary) <= offset) {
return mrb_nil_value();
}
return RARRAY_PTR(ary)[offset];
}
static mrb_value