mirror of
https://github.com/postgres/postgres.git
synced 2025-04-27 22:56:53 +03:00
Turn special page pointer validation to static inline function
Inclusion of multiple macros inside another macro was pushing MSVC past its size liimit. Reported by buildfarm.
This commit is contained in:
parent
1ff3f420d4
commit
56dffb5a73
@ -297,15 +297,32 @@ typedef PageHeaderData *PageHeader;
|
|||||||
#define PageGetSpecialSize(page) \
|
#define PageGetSpecialSize(page) \
|
||||||
((uint16) (PageGetPageSize(page) - ((PageHeader)(page))->pd_special))
|
((uint16) (PageGetPageSize(page) - ((PageHeader)(page))->pd_special))
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Using assertions, validate that the page special pointer is OK.
|
||||||
|
*
|
||||||
|
* This is intended to catch use of the pointer before page initialization.
|
||||||
|
* It is implemented as a function do to the limitations of the MSVC compiler,
|
||||||
|
* which choked on doing all these tests within another macro. We return true
|
||||||
|
* so that MacroAssert() can be used while still getting the specifics from
|
||||||
|
* the macro failure within this function.
|
||||||
|
*/
|
||||||
|
static inline bool
|
||||||
|
PageValidateSpecialPointer(Page page)
|
||||||
|
{
|
||||||
|
Assert(PageIsValid(page));
|
||||||
|
Assert(((PageHeader) (page))->pd_special <= BLCKSZ);
|
||||||
|
Assert(((PageHeader) (page))->pd_special >= SizeOfPageHeaderData);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* PageGetSpecialPointer
|
* PageGetSpecialPointer
|
||||||
* Returns pointer to special space on a page.
|
* Returns pointer to special space on a page.
|
||||||
*/
|
*/
|
||||||
#define PageGetSpecialPointer(page) \
|
#define PageGetSpecialPointer(page) \
|
||||||
( \
|
( \
|
||||||
AssertMacro(PageIsValid(page)), \
|
AssertMacro(PageValidateSpecialPointer(page)), \
|
||||||
AssertMacro(((PageHeader) (page))->pd_special <= BLCKSZ), \
|
|
||||||
AssertMacro(((PageHeader) (page))->pd_special >= SizeOfPageHeaderData), \
|
|
||||||
(char *) ((char *) (page) + ((PageHeader) (page))->pd_special) \
|
(char *) ((char *) (page) + ((PageHeader) (page))->pd_special) \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user