From b3692f94bf1eb991c242115fb938a47b59de43be Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Wed, 5 Oct 2016 23:58:00 +0300 Subject: [PATCH] Eliminate 'scope of variable can be reduced' cppcheck warning in allchblk * allchblk.c [USE_MUNMAP] (GC_merge_unmapped): Move local variable declarations to the inner scope where the variables are actually used. --- allchblk.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/allchblk.c b/allchblk.c index 1481264b..df9b6b0e 100644 --- a/allchblk.c +++ b/allchblk.c @@ -419,14 +419,16 @@ GC_INNER void GC_unmap_old(void) /* fully mapped or fully unmapped. */ GC_INNER void GC_merge_unmapped(void) { - struct hblk * h, *next; - hdr * hhdr, *nexthdr; - word size, nextsize; int i; for (i = 0; i <= N_HBLK_FLS; ++i) { - h = GC_hblkfreelist[i]; + struct hblk *h = GC_hblkfreelist[i]; + while (h != 0) { + struct hblk *next; + hdr *hhdr, *nexthdr; + word size, nextsize; + GET_HDR(h, hhdr); size = hhdr->hb_sz; next = (struct hblk *)((word)h + size); -- 2.40.0