diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2022-02-23 18:12:56 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2022-02-23 18:12:56 +0300 |
commit | d93875239734b39fc840c468fbb620551186468c (patch) | |
tree | d001dd61959fefd499be2fc8ff98908e53279dca /alloc.c | |
parent | 70f9e78d289a4a757093dc48ca6d08ca1b174f81 (diff) | |
download | bdwgc-d93875239734b39fc840c468fbb620551186468c.tar.gz |
Roundup size passed to GC_expand_hp
GC_expand_hp_inner accepts size in blocks; previously the size in
bytes was rounded down when converted to blocks in GC_expand_hp.
* alloc.c (GC_expand_hp): Declare n_blocks local variable and set its
value to OBJ_SZ_TO_BLOCKS_CHECKED(bytes); change type of result local
variable from int to GC_bool; pass n_blocks to GC_expand_hp_inner.
Diffstat (limited to 'alloc.c')
-rw-r--r-- | alloc.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -1601,15 +1601,16 @@ GC_INNER GC_bool GC_expand_hp_inner(word n) /* The argument is in bytes. Includes GC_init() call. */ GC_API int GC_CALL GC_expand_hp(size_t bytes) { - int result; + word n_blocks = OBJ_SZ_TO_BLOCKS_CHECKED(bytes); + GC_bool result; DCL_LOCK_STATE; if (!EXPECT(GC_is_initialized, TRUE)) GC_init(); LOCK(); - result = (int)GC_expand_hp_inner(divHBLKSZ((word)bytes)); + result = GC_expand_hp_inner(n_blocks); if (result) GC_requested_heapsize += bytes; UNLOCK(); - return(result); + return (int)result; } GC_INNER unsigned GC_fail_count = 0; |