1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-25 12:03:53 +03:00

Change the PageGetContents() macro to guarantee its result is maxalign'd,

thereby forestalling any problems with alignment of the data structure placed
there.  Since SizeOfPageHeaderData is maxalign'd anyway in 8.3 and HEAD, this
does not actually change anything right now, but it is foreseeable that the
header size will change again someday.  I had to fix a couple of places that
were assuming that the content offset is just SizeOfPageHeaderData rather than
MAXALIGN(SizeOfPageHeaderData).  Per discussion of Zdenek's page-macros patch.
This commit is contained in:
Tom Lane
2008-07-13 21:50:04 +00:00
parent 9d035f4254
commit 6816577a78
3 changed files with 21 additions and 18 deletions

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/storage/bufpage.h,v 1.81 2008/06/08 22:00:48 alvherre Exp $
* $PostgreSQL: pgsql/src/include/storage/bufpage.h,v 1.82 2008/07/13 21:50:04 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -206,9 +206,13 @@ typedef PageHeaderData *PageHeader;
/*
* PageGetContents
* To be used in case the page does not contain item pointers.
*
* Note: prior to 8.3 this was not guaranteed to yield a MAXALIGN'd result.
* Now it is. Beware of old code that might think the offset to the contents
* is just SizeOfPageHeaderData rather than MAXALIGN(SizeOfPageHeaderData).
*/
#define PageGetContents(page) \
((char *) (&((PageHeader) (page))->pd_linp[0]))
((char *) (page) + MAXALIGN(SizeOfPageHeaderData))
/* ----------------
* macros to access page size info