Re: [HACKERS] Unneeded NULL-pointer check in FreeSpaceMapTruncateRel

2015-07-01 Thread Michael Paquier
On Tue, Jun 30, 2015 at 9:57 PM, Andres Freund and...@anarazel.de wrote:
 On 2015-06-30 21:53:07 +0900, Michael Paquier wrote:
 In the category of nitpicky-code-style-issues, FreeSpaceMapTruncateRel
 is doing a NULL-pointer check for something that has been dereferenced
 on all the code paths leading to this check.
 (Yes, that's not interesting for common humans, Coverity sees things
 based on correctness).

 Can you, in the future, batch these together into one thread, perhaps
 with one message below an introductory one for each patch? Unless
 they'll get applied immediately it'll be hard to follow the different
 threads.

I'll try.
-- 
Michael


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


[HACKERS] Unneeded NULL-pointer check in FreeSpaceMapTruncateRel

2015-06-30 Thread Michael Paquier
Hi all,

In the category of nitpicky-code-style-issues, FreeSpaceMapTruncateRel
is doing a NULL-pointer check for something that has been dereferenced
on all the code paths leading to this check.
(Yes, that's not interesting for common humans, Coverity sees things
based on correctness).

Regards,
-- 
Michael
diff --git a/src/backend/storage/freespace/freespace.c b/src/backend/storage/freespace/freespace.c
index fddb47c..c948cb6 100644
--- a/src/backend/storage/freespace/freespace.c
+++ b/src/backend/storage/freespace/freespace.c
@@ -308,8 +308,7 @@ FreeSpaceMapTruncateRel(Relation rel, BlockNumber nblocks)
 	 * at the next command boundary.  But this ensures it isn't outright wrong
 	 * until then.
 	 */
-	if (rel-rd_smgr)
-		rel-rd_smgr-smgr_fsm_nblocks = new_nfsmblocks;
+	rel-rd_smgr-smgr_fsm_nblocks = new_nfsmblocks;
 }
 
 /*

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers