From: Ivan Maidanski Date: Mon, 31 Oct 2016 07:09:10 +0000 (+0300) Subject: Export GC_print_free_list() X-Git-Tag: v8.0.0~1050 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=644e9b75f05a27511c22ac1621b9a3b8842cfe6b;p=gc Export GC_print_free_list() Note: this function is not used by GC itself. * include/gc_inline.h (GC_print_free_list): New public API prototype. * reclaim.c [!NO_DEBUGGING]: Include gc_inline.h (to check that GC_print_free_list prototype matches the definition). * reclaim.c [!NO_DEBUGGING] (GC_print_free_list): Define as public (GC_API+GC_CALL); remove "ok" local variable; add assertions about kind and sz_in_granules maximum values. --- diff --git a/include/gc_inline.h b/include/gc_inline.h index f4d3b8d0..a4fb4e37 100644 --- a/include/gc_inline.h +++ b/include/gc_inline.h @@ -168,4 +168,7 @@ GC_API GC_ATTR_MALLOC GC_ATTR_ALLOC_SIZE(1) void * GC_CALL ((void **)(result))[1] = (void *)(second); \ } while (0) +GC_API void GC_CALL GC_print_free_list(int /* kind */, + size_t /* sz_in_granules */); + #endif /* !GC_INLINE_H */ diff --git a/reclaim.c b/reclaim.c index cee985de..8be53a08 100644 --- a/reclaim.c +++ b/reclaim.c @@ -565,13 +565,17 @@ void GC_print_block_list(void) (unsigned long)pstats.total_bytes); } +#include "gc_inline.h" /* for GC_print_free_list prototype */ + /* Currently for debugger use only: */ -void GC_print_free_list(int kind, size_t sz_in_granules) +GC_API void GC_CALL GC_print_free_list(int kind, size_t sz_in_granules) { - struct obj_kind * ok = &GC_obj_kinds[kind]; - ptr_t flh = ok -> ok_freelist[sz_in_granules]; + ptr_t flh; int n; + GC_ASSERT(kind < MAXOBJKINDS); + GC_ASSERT(sz_in_granules <= MAXOBJGRANULES); + flh = GC_obj_kinds[kind].ok_freelist[sz_in_granules]; for (n = 0; flh; n++) { struct hblk *block = HBLKPTR(flh); GC_printf("Free object in heap block %p [%d]: %p\n",