move range aware aget to array.c from mruby-array-ext gem

This commit is contained in:
Yukihiro "Matz" Matsumoto
2014-01-29 14:53:38 +09:00
parent b69bb896fc
commit 5346bdd76b
3 changed files with 67 additions and 58 deletions
+1 -3
View File
@@ -741,12 +741,10 @@ num_index:
/* check if indx is Range */
{
mrb_int beg, len;
mrb_value tmp;
len = RSTRING_LEN(str);
if (mrb_range_beg_len(mrb, indx, &beg, &len, len)) {
tmp = mrb_str_subseq(mrb, str, beg, len);
return tmp;
return mrb_str_subseq(mrb, str, beg, len);
}
else {
return mrb_nil_value();