Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8134fe4

Browse files
committed
Remove some pointless code in block.h.
There's no visible point in casting the result of a comparison tobool, because it already is that, at least on C99 compilers.I see no point in these assertions that a pointer we're about todereference isn't null, either. If it is, the resulting SIGSEGVwill notify us of the problem just fine.Noted while reviewing Zhihong Yu's patch. This is basicallycosmetic, so no need for back-patch.Discussion:https://postgr.es/m/CALNJ-vT9r0DSsAOw9OXVJFxLENoVS_68kJ5x0p44atoYH+H4dg@mail.gmail.com
1 parent0fbdfaf commit8134fe4

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
#defineBlockNumberIsValid(blockNumber) \
71-
((bool) ((BlockNumber) (blockNumber) != InvalidBlockNumber))
71+
((BlockNumber) (blockNumber) != InvalidBlockNumber)
7272

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

8080
/*
8181
* BlockIdSet
8282
*Sets a block identifier to the specified value.
8383
*/
8484
#defineBlockIdSet(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
#defineBlockIdCopy(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
#defineBlockIdGetBlockNumber(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)

[8]ページ先頭

©2009-2025 Movatter.jp