summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authornari <nari@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-14 02:13:51 +0000
committernari <nari@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-14 02:13:51 +0000
commit8c79b8b6b86f9c5a9dff46c0e6c99cf935b7f399 (patch)
tree09e4b3741d76700aded55ef9682b32a697152f70 /gc.c
parentbfa6c6b41b230277c4f264da117eca222b591efc (diff)
* gc.c: use size_t.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32077 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/gc.c b/gc.c
index 2b442d998b..c933423e28 100644
--- a/gc.c
+++ b/gc.c
@@ -1068,13 +1068,9 @@ assign_heap_slot(rb_objspace_t *objspace)
}
static void
-add_heap_slots(rb_objspace_t *objspace, int add)
+add_heap_slots(rb_objspace_t *objspace, size_t add)
{
- int i;
-
- if (add < 1) {
- add = 1;
- }
+ size_t i;
if ((heaps_used + add) > heaps_length) {
allocate_sorted_heaps(objspace, heaps_used + add);
@@ -1088,10 +1084,7 @@ add_heap_slots(rb_objspace_t *objspace, int add)
static void
init_heap(rb_objspace_t *objspace)
{
- int add;
-
- add = HEAP_MIN_SLOTS / HEAP_OBJ_LIMIT;
- add_heap_slots(objspace, add);
+ add_heap_slots(objspace, HEAP_MIN_SLOTS / HEAP_OBJ_LIMIT);
heaps_inc = 0;
objspace->profile.invoke_time = getrusage_time();
@@ -1102,11 +1095,10 @@ init_heap(rb_objspace_t *objspace)
static void
initial_expand_heap(rb_objspace_t *objspace)
{
- int add;
+ size_t min_size = initial_heap_min_slots / HEAP_OBJ_LIMIT;
- add = ((initial_heap_min_slots / HEAP_OBJ_LIMIT) - heaps_used);
- if (add > 0) {
- add_heap_slots(objspace, add);
+ if (min_size > heaps_used) {
+ add_heap_slots(objspace, min_size - heaps_used);
}
}
#endif