@@ -59,57 +59,50 @@ typedef struct BlockIdData
59
59
typedef BlockIdData * BlockId ; /* block identifier */
60
60
61
61
/* ----------------
62
- * support macros
62
+ * support functions
63
63
* ----------------
64
64
*/
65
65
66
66
/*
67
67
* BlockNumberIsValid
68
68
* True iff blockNumber is valid.
69
69
*/
70
- #define BlockNumberIsValid (blockNumber ) \
71
- ((BlockNumber) (blockNumber) != InvalidBlockNumber)
72
-
73
- /*
74
- * BlockIdIsValid
75
- * True iff the block identifier is valid.
76
- */
77
- #define BlockIdIsValid (blockId ) \
78
- PointerIsValid(blockId)
70
+ static inline bool
71
+ BlockNumberIsValid (BlockNumber blockNumber )
72
+ {
73
+ return blockNumber != InvalidBlockNumber ;
74
+ }
79
75
80
76
/*
81
77
* BlockIdSet
82
78
* Sets a block identifier to the specified value.
83
79
*/
84
- #define BlockIdSet (blockId , blockNumber ) \
85
- ( \
86
- (blockId)->bi_hi = (blockNumber) >> 16, \
87
- (blockId)->bi_lo = (blockNumber) & 0xffff \
88
- )
89
-
90
- /*
91
- * BlockIdCopy
92
- * Copy a block identifier.
93
- */
94
- #define BlockIdCopy (toBlockId , fromBlockId ) \
95
- ( \
96
- (toBlockId)->bi_hi = (fromBlockId)->bi_hi, \
97
- (toBlockId)->bi_lo = (fromBlockId)->bi_lo \
98
- )
80
+ static inline void
81
+ BlockIdSet (BlockIdData * blockId , BlockNumber blockNumber )
82
+ {
83
+ blockId -> bi_hi = blockNumber >> 16 ;
84
+ blockId -> bi_lo = blockNumber & 0xffff ;
85
+ }
99
86
100
87
/*
101
88
* BlockIdEquals
102
89
* Check for block number equality.
103
90
*/
104
- #define BlockIdEquals (blockId1 , blockId2 ) \
105
- ((blockId1)->bi_hi == (blockId2)->bi_hi && \
106
- (blockId1)->bi_lo == (blockId2)->bi_lo)
91
+ static inline bool
92
+ BlockIdEquals (const BlockIdData * blockId1 , const BlockIdData * blockId2 )
93
+ {
94
+ return (blockId1 -> bi_hi == blockId2 -> bi_hi &&
95
+ blockId1 -> bi_lo == blockId2 -> bi_lo );
96
+ }
107
97
108
98
/*
109
99
* BlockIdGetBlockNumber
110
100
* Retrieve the block number from a block identifier.
111
101
*/
112
- #define BlockIdGetBlockNumber (blockId ) \
113
- ((((BlockNumber) (blockId)->bi_hi) << 16) | ((BlockNumber) (blockId)->bi_lo))
102
+ static inline BlockNumber
103
+ BlockIdGetBlockNumber (const BlockIdData * blockId )
104
+ {
105
+ return (((BlockNumber ) blockId -> bi_hi ) << 16 ) | ((BlockNumber ) blockId -> bi_lo );
106
+ }
114
107
115
108
#endif /* BLOCK_H */
0 commit comments