Skip to content

Commit

Permalink
Fix 'scope of source var can be reduced' cppcheck warning in dbg_mlc.c
Browse files Browse the repository at this point in the history
(fix of commit f68db21)

Issue #627 (bdwgc).

* dbg_mlc.c [KEEP_BACK_PTRS] (GC_print_backtrace): Move source, offset,
base local variables to the inner scope.
  • Loading branch information
ivmai committed Jun 12, 2024
1 parent f985d63 commit 9885233
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions dbg_mlc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 9885233

Please sign in to comment.