summaryrefslogtreecommitdiff
path: root/headers.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2022-10-31 21:27:32 +0300
committerIvan Maidanski <ivmai@mail.ru>2022-11-01 00:50:08 +0300
commit2343f553de8e127eb8540c5044d355dc5fb490cd (patch)
treef41632cce4bb5df45669071f00d756e95de740ee /headers.c
parentc0e2c507f11e43f043a866514b5b75c60f71dc53 (diff)
downloadbdwgc-2343f553de8e127eb8540c5044d355dc5fb490cd.tar.gz
Fix negative heap size values reported in WARN
Issue #496 (bdwgc). WARN_PRIuPTR is now used to print unsigned values in WARN() calls. Also, byte values are replaced with KiB ones in some WARN() calls. * allchblk.c (GC_allochblk_nth): Use WARN_PRIuPTR specifier instead of WARN_PRIdPTR. * alloc.c (GC_expand_hp_inner, GC_collect_or_expand): Likewise. * headers.c (GC_scratch_alloc): Likewise. * mark.c (alloc_mark_stack): Likewise. * misc.c (GC_enable): Likewise. * os_dep.c [NEED_PROC_MAPS] (GC_get_maps): Likewise. * os_dep.c [PROC_VDB] (GC_proc_read_dirty): Likewise. * win32_threads.c (GC_delete_thread): Likewise. * allchblk.c (GC_allochblk_nth): Print KiB value instead of in bytes in WARN message. * alloc.c (GC_expand_hp_inner): Likewise. * misc.c (GC_enable): Likewise. * alloc.c (GC_expand_hp_inner): Remove unneeded cast of bytes to word. * headers.c (GC_scratch_alloc): Likewise. * alloc.c [(!AMIGA || !GC_AMIGA_FASTALLOC) && USE_MUNMAP] (GC_collect_or_expand): Add assertion to indicate that there is no underflow in GC_heapsize-GC_unmapped_bytes. * include/private/gc_priv.h (WARN): Update comment. * include/private/gc_priv.h [!WARN_PRIdPTR] (WARN_PRIuPTR): Define.
Diffstat (limited to 'headers.c')
-rw-r--r--headers.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/headers.c b/headers.c
index b40fdfb8..9e4df98f 100644
--- a/headers.c
+++ b/headers.c
@@ -140,7 +140,7 @@ GC_INNER ptr_t GC_scratch_alloc(size_t bytes)
result = (ptr_t)GET_MEM(bytes_to_get);
if (EXPECT(NULL == result, FALSE)) {
WARN("Out of memory - trying to allocate requested amount"
- " (%" WARN_PRIdPTR " bytes)...\n", (word)bytes);
+ " (%" WARN_PRIuPTR " bytes)...\n", bytes);
bytes_to_get = ROUNDUP_PAGESIZE_IF_MMAP(bytes);
result = (ptr_t)GET_MEM(bytes_to_get);
if (result != NULL) {