From cc1fc5332ab0508d1e5f848e4fece3afa10606de Mon Sep 17 00:00:00 2001 From: Masaki Muranaka Date: Tue, 31 Jul 2012 14:52:44 +0900 Subject: Remove redundant code in mrb_array_aget(). --- src/array.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/array.c b/src/array.c index c385fe99b..804c946da 100644 --- a/src/array.c +++ b/src/array.c @@ -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); -- cgit v1.2.3 From 0cee3bb5317a220da7c123059a2c08daec288d30 Mon Sep 17 00:00:00 2001 From: Masaki Muranaka Date: Tue, 31 Jul 2012 16:47:53 +0900 Subject: POOL_ALIGNMENT POOL_PAGE_SIZE : Configurable parameters. --- include/mrbconf.h | 6 ++++++ src/pool.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/include/mrbconf.h b/include/mrbconf.h index 3d1e1757d..20f49ec29 100644 --- a/include/mrbconf.h +++ b/include/mrbconf.h @@ -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 */ diff --git a/src/pool.c b/src/pool.c index 36c6fa8eb..daa6d0f69 100644 --- a/src/pool.c +++ b/src/pool.c @@ -9,7 +9,7 @@ #include /* 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 -- cgit v1.2.3