summaryrefslogtreecommitdiff
path: root/allchblk.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2021-06-13 11:31:45 +0300
committerIvan Maidanski <ivmai@mail.ru>2021-06-13 11:31:45 +0300
commit6e115ed209782f0d34f577628109590b564c71d4 (patch)
tree9dccccaa07c62b0a11875651d4ebb0ea88a79c60 /allchblk.c
parenta36aa012d9c086ef19f871b4fa485eca3aae28d5 (diff)
downloadbdwgc-6e115ed209782f0d34f577628109590b564c71d4.tar.gz
Fix 'scope of phdr can be reduced' cppcheck error in free_block_ending_at
(fix of commit 9245e1154) Issue #324 (bdwgc). * allchblk.c (GC_free_block_ending_at): Declare phdr local variable only if p is non-null.
Diffstat (limited to 'allchblk.c')
-rw-r--r--allchblk.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/allchblk.c b/allchblk.c
index d96d3a8a..282089cd 100644
--- a/allchblk.c
+++ b/allchblk.c
@@ -354,10 +354,10 @@ static struct hblk * get_block_ending_at(struct hblk *h)
STATIC struct hblk * GC_free_block_ending_at(struct hblk *h)
{
struct hblk * p = get_block_ending_at(h);
- hdr * phdr;
if (p /* != NULL */) { /* CPPCHECK */
- phdr = HDR(p);
+ hdr * phdr = HDR(p);
+
if (HBLK_IS_FREE(phdr)) {
return p;
}