diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2022-03-03 19:15:38 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2022-03-03 19:15:38 -0500 |
commit | 8134fe4ad80a1f9673770126ed7c45045b8ef467 (patch) | |
tree | a8bae5015be7060b4a46aa5ba7e0c355ba59212c | |
parent | 0fbdfaf79d0bbfe1ede9d8ca2d85b2c9a8513082 (diff) | |
download | postgresql-8134fe4ad80a1f9673770126ed7c45045b8ef467.tar.gz postgresql-8134fe4ad80a1f9673770126ed7c45045b8ef467.zip |
Remove some pointless code in block.h.
There's no visible point in casting the result of a comparison to
bool, because it already is that, at least on C99 compilers.
I see no point in these assertions that a pointer we're about to
dereference isn't null, either. If it is, the resulting SIGSEGV
will notify us of the problem just fine.
Noted while reviewing Zhihong Yu's patch. This is basically
cosmetic, so no need for back-patch.
Discussion: https://postgr.es/m/CALNJ-vT9r0DSsAOw9OXVJFxLENoVS_68kJ5x0p44atoYH+H4dg@mail.gmail.com
-rw-r--r-- | src/include/storage/block.h | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/include/storage/block.h b/src/include/storage/block.h index cf1fc499df3..d756e3fda5e 100644 --- a/src/include/storage/block.h +++ b/src/include/storage/block.h @@ -68,14 +68,14 @@ typedef BlockIdData *BlockId; /* block identifier */ * True iff blockNumber is valid. */ #define BlockNumberIsValid(blockNumber) \ - ((bool) ((BlockNumber) (blockNumber) != InvalidBlockNumber)) + ((BlockNumber) (blockNumber) != InvalidBlockNumber) /* * BlockIdIsValid * True iff the block identifier is valid. */ #define BlockIdIsValid(blockId) \ - ((bool) PointerIsValid(blockId)) + PointerIsValid(blockId) /* * BlockIdSet @@ -83,7 +83,6 @@ typedef BlockIdData *BlockId; /* block identifier */ */ #define BlockIdSet(blockId, blockNumber) \ ( \ - AssertMacro(PointerIsValid(blockId)), \ (blockId)->bi_hi = (blockNumber) >> 16, \ (blockId)->bi_lo = (blockNumber) & 0xffff \ ) @@ -94,8 +93,6 @@ typedef BlockIdData *BlockId; /* block identifier */ */ #define BlockIdCopy(toBlockId, fromBlockId) \ ( \ - AssertMacro(PointerIsValid(toBlockId)), \ - AssertMacro(PointerIsValid(fromBlockId)), \ (toBlockId)->bi_hi = (fromBlockId)->bi_hi, \ (toBlockId)->bi_lo = (fromBlockId)->bi_lo \ ) @@ -113,9 +110,6 @@ typedef BlockIdData *BlockId; /* block identifier */ * Retrieve the block number from a block identifier. */ #define BlockIdGetBlockNumber(blockId) \ -( \ - AssertMacro(BlockIdIsValid(blockId)), \ - ((((BlockNumber) (blockId)->bi_hi) << 16) | ((BlockNumber) (blockId)->bi_lo)) \ -) + ((((BlockNumber) (blockId)->bi_hi) << 16) | ((BlockNumber) (blockId)->bi_lo)) #endif /* BLOCK_H */ |