From 98852332d32c5d2d50dfbc4cd5172431112e0516 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Wed, 12 Jun 2024 16:55:54 +0300 Subject: [PATCH] Fix 'scope of source var can be reduced' cppcheck warning in dbg_mlc.c (fix of commit f68db211d) Issue #627 (bdwgc). * dbg_mlc.c [KEEP_BACK_PTRS] (GC_print_backtrace): Move source, offset, base local variables to the inner scope. --- dbg_mlc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dbg_mlc.c b/dbg_mlc.c index 5c4f8a55b..6d67c2e03 100644 --- a/dbg_mlc.c +++ b/dbg_mlc.c @@ -185,15 +185,15 @@ { void *current = p; int i; - GC_ref_kind source; - size_t offset; - void *base; GC_ASSERT(I_DONT_HOLD_LOCK()); GC_print_heap_obj((ptr_t)GC_base(current)); for (i = 0;; ++i) { - source = GC_get_back_ptr_info(current, &base, &offset); + void *base; + size_t offset; + GC_ref_kind source = GC_get_back_ptr_info(current, &base, &offset); + if (GC_UNREFERENCED == source) { GC_err_printf("Reference could not be found\n"); break;