File tree 1 file changed +20
-3
lines changed
1 file changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -297,15 +297,32 @@ typedef PageHeaderData *PageHeader;
297
297
#define PageGetSpecialSize (page ) \
298
298
((uint16) (PageGetPageSize(page) - ((PageHeader)(page))->pd_special))
299
299
300
+ /*
301
+ * Using assertions, validate that the page special pointer is OK.
302
+ *
303
+ * This is intended to catch use of the pointer before page initialization.
304
+ * It is implemented as a function do to the limitations of the MSVC compiler,
305
+ * which choked on doing all these tests within another macro. We return true
306
+ * so that MacroAssert() can be used while still getting the specifics from
307
+ * the macro failure within this function.
308
+ */
309
+ static inline bool
310
+ PageValidateSpecialPointer (Page page )
311
+ {
312
+ Assert (PageIsValid (page ));
313
+ Assert (((PageHeader ) (page ))-> pd_special <= BLCKSZ );
314
+ Assert (((PageHeader ) (page ))-> pd_special >= SizeOfPageHeaderData );
315
+
316
+ return true;
317
+ }
318
+
300
319
/*
301
320
* PageGetSpecialPointer
302
321
* Returns pointer to special space on a page.
303
322
*/
304
323
#define PageGetSpecialPointer (page ) \
305
324
( \
306
- AssertMacro(PageIsValid(page)), \
307
- AssertMacro(((PageHeader) (page))->pd_special <= BLCKSZ), \
308
- AssertMacro(((PageHeader) (page))->pd_special >= SizeOfPageHeaderData), \
325
+ AssertMacro(PageValidateSpecialPointer(page)), \
309
326
(char *) ((char *) (page) + ((PageHeader) (page))->pd_special) \
310
327
)
311
328
You can’t perform that action at this time.
0 commit comments