aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/transam
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2008-07-13 20:45:47 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2008-07-13 20:45:47 +0000
commit9d035f425452279041c52e01cf83b2a27e121b5c (patch)
treed521a3bdb9ca231ed49e09a48259a45b519f6d1c /src/backend/access/transam
parent45efb09a01e93d20ccb5671703649d9f87f744de (diff)
downloadpostgresql-9d035f425452279041c52e01cf83b2a27e121b5c.tar.gz
postgresql-9d035f425452279041c52e01cf83b2a27e121b5c.zip
Clean up the use of some page-header-access macros: principally, use
SizeOfPageHeaderData instead of sizeof(PageHeaderData) in places where that makes the code clearer, and avoid casting between Page and PageHeader where possible. Zdenek Kotala, with some additional cleanup by Heikki Linnakangas. I did not apply the parts of the proposed patch that would have resulted in slightly changing the on-disk format of hash indexes; it seems to me that's not a win as long as there's any chance of having in-place upgrade for 8.4.
Diffstat (limited to 'src/backend/access/transam')
-rw-r--r--src/backend/access/transam/xlog.c14
-rw-r--r--src/backend/access/transam/xlogutils.c4
2 files changed, 9 insertions, 9 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 2e832db4b15..72e531d3dc3 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -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/backend/access/transam/xlog.c,v 1.315 2008/06/30 22:10:43 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.316 2008/07/13 20:45:47 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1017,19 +1017,19 @@ static bool
XLogCheckBuffer(XLogRecData *rdata, bool doPageWrites,
XLogRecPtr *lsn, BkpBlock *bkpb)
{
- PageHeader page;
+ Page page;
- page = (PageHeader) BufferGetBlock(rdata->buffer);
+ page = BufferGetPage(rdata->buffer);
/*
* XXX We assume page LSN is first data on *every* page that can be passed
* to XLogInsert, whether it otherwise has the standard page layout or
* not.
*/
- *lsn = page->pd_lsn;
+ *lsn = PageGetLSN(page);
if (doPageWrites &&
- XLByteLE(page->pd_lsn, RedoRecPtr))
+ XLByteLE(PageGetLSN(page), RedoRecPtr))
{
/*
* The page needs to be backed up, so set up *bkpb
@@ -1040,8 +1040,8 @@ XLogCheckBuffer(XLogRecData *rdata, bool doPageWrites,
if (rdata->buffer_std)
{
/* Assume we can omit data between pd_lower and pd_upper */
- uint16 lower = page->pd_lower;
- uint16 upper = page->pd_upper;
+ uint16 lower = ((PageHeader) page)->pd_lower;
+ uint16 upper = ((PageHeader) page)->pd_upper;
if (lower >= SizeOfPageHeaderData &&
upper > lower &&
diff --git a/src/backend/access/transam/xlogutils.c b/src/backend/access/transam/xlogutils.c
index 9a2f18d5318..3e2d5046da6 100644
--- a/src/backend/access/transam/xlogutils.c
+++ b/src/backend/access/transam/xlogutils.c
@@ -11,7 +11,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/access/transam/xlogutils.c,v 1.56 2008/06/19 00:46:03 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/xlogutils.c,v 1.57 2008/07/13 20:45:47 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -279,7 +279,7 @@ XLogReadBuffer(RelFileNode rnode, BlockNumber blkno, bool init)
/* check that page has been initialized */
Page page = (Page) BufferGetPage(buffer);
- if (PageIsNew((PageHeader) page))
+ if (PageIsNew(page))
{
UnlockReleaseBuffer(buffer);
log_invalid_page(rnode, blkno, true);