Commit 9bfc64b4 authored by Yukihiro Matsumoto's avatar Yukihiro Matsumoto

Merge branch 'master' of github.com:mruby/mruby

parents e064ff20 954c33a8
......@@ -25,6 +25,12 @@
/* default size of khash table bucket */
//#define KHASH_DEFAULT_SIZE 32
/* allocated memory address alignment */
//#define POOL_ALIGNMENT 4
/* page size of memory pool */
//#define POOL_PAGE_SIZE 16000
/* -DDISABLE_XXXX to drop the feature */
#define DISABLE_REGEXP /* regular expression classes */
//#define DISABLE_SPRINTF /* Kernel.sprintf method */
......
......@@ -682,10 +682,10 @@ mrb_ary_aget(mrb_state *mrb, mrb_value self)
if (mrb_type(argv[0]) != MRB_TT_FIXNUM) {
mrb_raise(mrb, E_TYPE_ERROR, "expected Fixnum");
}
len = mrb_fixnum(argv[0]);
if (index < 0) index += a->len;
if (index < 0 || a->len < (int)index) return mrb_nil_value();
if ((len = mrb_fixnum(argv[0])) < 0) return mrb_nil_value();
len = mrb_fixnum(argv[0]);
if (len < 0) return mrb_nil_value();
if (a->len == (int)index) return mrb_ary_new(mrb);
if ((int)len > a->len - index) len = a->len - index;
return ary_subseq(mrb, a, index, len);
......
......@@ -9,7 +9,7 @@
#include <string.h>
/* configuration section */
/* allcated memory address should be multiple of POOL_ALLOC_ALIGN */
/* allocated memory address should be multiple of POOL_ALIGNMENT */
/* or undef it if alignment does not matter */
#ifndef POOL_ALIGNMENT
#define POOL_ALIGNMENT 4
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment