Content-Length: 315118 | pFad | http://github.com/postgrespro/postgres/commit/8134fe4ad80a1f9673770126ed7c45045b8ef467

55 Remove some pointless code in block.h. · postgrespro/postgres@8134fe4 · GitHub
Skip to content

Commit 8134fe4

Browse files
committed
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
1 parent 0fbdfaf commit 8134fe4

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/include/storage/block.h

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,22 +68,21 @@ typedef BlockIdData *BlockId; /* block identifier */
6868
* True iff blockNumber is valid.
6969
*/
7070
#define BlockNumberIsValid(blockNumber) \
71-
((bool) ((BlockNumber) (blockNumber) != InvalidBlockNumber))
71+
((BlockNumber) (blockNumber) != InvalidBlockNumber)
7272

7373
/*
7474
* BlockIdIsValid
7575
* True iff the block identifier is valid.
7676
*/
7777
#define BlockIdIsValid(blockId) \
78-
((bool) PointerIsValid(blockId))
78+
PointerIsValid(blockId)
7979

8080
/*
8181
* BlockIdSet
8282
* Sets a block identifier to the specified value.
8383
*/
8484
#define BlockIdSet(blockId, blockNumber) \
8585
( \
86-
AssertMacro(PointerIsValid(blockId)), \
8786
(blockId)->bi_hi = (blockNumber) >> 16, \
8887
(blockId)->bi_lo = (blockNumber) & 0xffff \
8988
)
@@ -94,8 +93,6 @@ typedef BlockIdData *BlockId; /* block identifier */
9493
*/
9594
#define BlockIdCopy(toBlockId, fromBlockId) \
9695
( \
97-
AssertMacro(PointerIsValid(toBlockId)), \
98-
AssertMacro(PointerIsValid(fromBlockId)), \
9996
(toBlockId)->bi_hi = (fromBlockId)->bi_hi, \
10097
(toBlockId)->bi_lo = (fromBlockId)->bi_lo \
10198
)
@@ -113,9 +110,6 @@ typedef BlockIdData *BlockId; /* block identifier */
113110
* Retrieve the block number from a block identifier.
114111
*/
115112
#define BlockIdGetBlockNumber(blockId) \
116-
( \
117-
AssertMacro(BlockIdIsValid(blockId)), \
118-
((((BlockNumber) (blockId)->bi_hi) << 16) | ((BlockNumber) (blockId)->bi_lo)) \
119-
)
113+
((((BlockNumber) (blockId)->bi_hi) << 16) | ((BlockNumber) (blockId)->bi_lo))
120114

121115
#endif /* BLOCK_H */

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/8134fe4ad80a1f9673770126ed7c45045b8ef467

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy