aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/heap/hio.c
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/heap/hio.c
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/heap/hio.c')
-rw-r--r--src/backend/access/heap/hio.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/backend/access/heap/hio.c b/src/backend/access/heap/hio.c
index df902a02f3b..6db80590de6 100644
--- a/src/backend/access/heap/hio.c
+++ b/src/backend/access/heap/hio.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/heap/hio.c,v 1.71 2008/06/08 22:00:47 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/access/heap/hio.c,v 1.72 2008/07/13 20:45:47 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -107,7 +107,7 @@ RelationGetBufferForTuple(Relation relation, Size len,
Buffer otherBuffer, bool use_fsm)
{
Buffer buffer = InvalidBuffer;
- Page pageHeader;
+ Page page;
Size pageFreeSpace,
saveFreeSpace;
BlockNumber targetBlock,
@@ -218,8 +218,8 @@ RelationGetBufferForTuple(Relation relation, Size len,
* Now we can check to see if there's enough free space here. If so,
* we're done.
*/
- pageHeader = (Page) BufferGetPage(buffer);
- pageFreeSpace = PageGetHeapFreeSpace(pageHeader);
+ page = BufferGetPage(buffer);
+ pageFreeSpace = PageGetHeapFreeSpace(page);
if (len + saveFreeSpace <= pageFreeSpace)
{
/* use this page as future insert target, too */
@@ -303,16 +303,16 @@ RelationGetBufferForTuple(Relation relation, Size len,
* is empty (this should never happen, but if it does we don't want to
* risk wiping out valid data).
*/
- pageHeader = (Page) BufferGetPage(buffer);
+ page = BufferGetPage(buffer);
- if (!PageIsNew((PageHeader) pageHeader))
+ if (!PageIsNew(page))
elog(ERROR, "page %u of relation \"%s\" should be empty but is not",
BufferGetBlockNumber(buffer),
RelationGetRelationName(relation));
- PageInit(pageHeader, BufferGetPageSize(buffer), 0);
+ PageInit(page, BufferGetPageSize(buffer), 0);
- if (len > PageGetHeapFreeSpace(pageHeader))
+ if (len > PageGetHeapFreeSpace(page))
{
/* We should not get here given the test at the top */
elog(PANIC, "tuple is too big: size %lu", (unsigned long) len);