*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/page/bufpage.c,v 1.65 2005/06/06 20:22:58 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/page/bufpage.c,v 1.66 2005/09/22 16:45:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
if (offsetNumber < limit)
{
itemId = PageGetItemId(phdr, offsetNumber);
- if ((itemId->lp_flags & LP_USED) ||
- (itemId->lp_len != 0))
+ if (ItemIdIsUsed(itemId) || ItemIdGetLength(itemId) != 0)
{
elog(WARNING, "will not overwrite a used ItemId");
return InvalidOffsetNumber;
for (offsetNumber = 1; offsetNumber < limit; offsetNumber++)
{
itemId = PageGetItemId(phdr, offsetNumber);
- if (((itemId->lp_flags & LP_USED) == 0) &&
- (itemId->lp_len == 0))
+ if (!ItemIdIsUsed(itemId) && ItemIdGetLength(itemId) == 0)
break;
}
/* if no free slot, we'll put it at limit (1st open slot) */
for (i = 0; i < nline; i++)
{
lp = PageGetItemId(page, i + 1);
- if (lp->lp_flags & LP_DELETE) /* marked for deletion */
+ if (ItemIdDeleted(lp)) /* marked for deletion */
lp->lp_flags &= ~(LP_USED | LP_DELETE);
- if (lp->lp_flags & LP_USED)
+ if (ItemIdIsUsed(lp))
nused++;
else if (unused)
unused[i - nused] = (OffsetNumber) i;
for (i = 0; i < nline; i++)
{
lp = PageGetItemId(page, i + 1);
- if (lp->lp_flags & LP_USED)
+ if (ItemIdIsUsed(lp))
{
itemidptr->offsetindex = i;
- itemidptr->itemoff = lp->lp_off;
+ itemidptr->itemoff = ItemIdGetOffset(lp);
if (itemidptr->itemoff < (int) pd_upper ||
itemidptr->itemoff >= (int) pd_special)
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
errmsg("corrupted item pointer: %u",
itemidptr->itemoff)));
- itemidptr->alignedlen = MAXALIGN(lp->lp_len);
+ itemidptr->alignedlen = MAXALIGN(ItemIdGetLength(lp));
totallen += itemidptr->alignedlen;
itemidptr++;
}
{
ItemId ii = PageGetItemId(phdr, i);
- if (ii->lp_off <= offset)
+ if (ItemIdGetOffset(ii) <= offset)
ii->lp_off += size;
}
}
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/storage/bufpage.h,v 1.65 2005/04/28 21:47:18 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/storage/bufpage.h,v 1.66 2005/09/22 16:46:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#define PageGetItem(page, itemId) \
( \
AssertMacro(PageIsValid(page)), \
- AssertMacro((itemId)->lp_flags & LP_USED), \
- (Item)(((char *)(page)) + (itemId)->lp_off) \
+ AssertMacro(ItemIdIsUsed(itemId)), \
+ (Item)(((char *)(page)) + ItemIdGetOffset(itemId)) \
)
/*
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/storage/itemid.h,v 1.24 2004/12/31 22:03:42 pgsql Exp $
+ * $PostgreSQL: pgsql/src/include/storage/itemid.h,v 1.25 2005/09/22 16:46:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* This bit may be passed to PageAddItem together with
- * LP_USED & LP_DELETED bits to specify overwrite mode
+ * LP_USED & LP_DELETE bits to specify overwrite mode
*/
#define OverwritePageMode 0x10