diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2021-06-13 11:31:45 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2021-06-13 11:31:45 +0300 |
commit | 6e115ed209782f0d34f577628109590b564c71d4 (patch) | |
tree | 9dccccaa07c62b0a11875651d4ebb0ea88a79c60 /allchblk.c | |
parent | a36aa012d9c086ef19f871b4fa485eca3aae28d5 (diff) | |
download | bdwgc-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.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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; } |