ruby-changes:20030
From: nari <ko1@a...>
Date: Tue, 14 Jun 2011 11:14:06 +0900 (JST)
Subject: [ruby-changes:20030] nari:r32077 (trunk): * gc.c: use size_t.
nari 2011-06-14 11:13:51 +0900 (Tue, 14 Jun 2011) New Revision: 32077 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=32077 Log: * gc.c: use size_t. Modified files: trunk/ChangeLog trunk/gc.c Index: ChangeLog =================================================================== --- ChangeLog (revision 32076) +++ ChangeLog (revision 32077) @@ -1,3 +1,7 @@ +Tue Jun 14 11:02:08 2011 Narihiro Nakamura <narihiro@n...> + + * gc.c: use size_t. + Tue Jun 14 01:10:38 2011 Yusuke Endoh <mame@t...> * test/coverage/test_coverage.rb: add a test for restart. a patch Index: gc.c =================================================================== --- gc.c (revision 32076) +++ gc.c (revision 32077) @@ -1068,14 +1068,10 @@ } static void -add_heap_slots(rb_objspace_t *objspace, int add) +add_heap_slots(rb_objspace_t *objspace, size_t add) { - int i; + size_t i; - if (add < 1) { - add = 1; - } - if ((heaps_used + add) > heaps_length) { allocate_sorted_heaps(objspace, heaps_used + add); } @@ -1088,11 +1084,8 @@ static void init_heap(rb_objspace_t *objspace) { - int add; + add_heap_slots(objspace, HEAP_MIN_SLOTS / HEAP_OBJ_LIMIT); - add = HEAP_MIN_SLOTS / HEAP_OBJ_LIMIT; - add_heap_slots(objspace, add); - heaps_inc = 0; objspace->profile.invoke_time = getrusage_time(); finalizer_table = st_init_numtable(); @@ -1102,11 +1095,10 @@ 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/