summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gc.c4
-rw-r--r--src/variable.c7
2 files changed, 5 insertions, 6 deletions
diff --git a/src/gc.c b/src/gc.c
index e92516ca7..be812c4d3 100644
--- a/src/gc.c
+++ b/src/gc.c
@@ -1601,8 +1601,8 @@ mrb_objspace_each_objects(mrb_state *mrb, mrb_each_object_callback *callback, vo
}
}
-const mrb_int
-mrb_objspace_page_slot_size()
+mrb_int
+mrb_objspace_page_slot_size(void)
{
const mrb_int i = sizeof(RVALUE);
return i;
diff --git a/src/variable.c b/src/variable.c
index 0c94f412e..8b4bdf0ce 100644
--- a/src/variable.c
+++ b/src/variable.c
@@ -4,7 +4,6 @@
** See Copyright Notice in mruby.h
*/
-#include <math.h>
#include <mruby.h>
#include <mruby/array.h>
#include <mruby/class.h>
@@ -1132,9 +1131,9 @@ mrb_class_find_path(mrb_state *mrb, struct RClass *c)
mrb_int
mrb_obj_iv_tbl_memsize(mrb_state* mrb, mrb_value obj)
{
- return sizeof(iv_tbl) +
- (sizeof(segment) * ceil(iv_size(mrb, mrb_obj_ptr(obj)->iv)/
- MRB_IV_SEGMENT_SIZE));
+ size_t ivsize = iv_size(mrb, mrb_obj_ptr(obj)->iv);
+ size_t ivsegs = (ivsize + MRB_IV_SEGMENT_SIZE - 1) / MRB_IV_SEGMENT_SIZE;
+ return sizeof(iv_tbl) + (sizeof(segment) * ivsegs);
}
#define identchar(c) (ISALNUM(c) || (c) == '_' || !ISASCII(c))