approproate.
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.57 1999/07/17 20:16:35 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.58 1999/07/19 07:07:15 momjian Exp $
*
* NOTES
* The old interface functions have been converted to macros
len += bitmaplen;
}
- hoff = len = DOUBLEALIGN(len); /* be conservative here */
+ hoff = len = MAXALIGN(len); /* be conservative here */
len += ComputeDataSize(tupleDescriptor, value, nulls);
len = offsetof(HeapTupleHeaderData, t_bits);
- hoff = len = DOUBLEALIGN(len); /* be conservative */
+ hoff = len = MAXALIGN(len); /* be conservative */
len += structlen;
tuple = (HeapTuple) palloc(HEAPTUPLESIZE + len);
td = tuple->t_data = (HeapTupleHeader) ((char *) tuple + HEAPTUPLESIZE);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.37 1999/07/17 20:16:35 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.38 1999/07/19 07:07:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
hoff = IndexInfoFindDataOffset(infomask);
size = hoff + ComputeDataSize(tupleDescriptor, value, null);
- size = DOUBLEALIGN(size); /* be conservative */
+ size = MAXALIGN(size); /* be conservative */
tp = (char *) palloc(size);
tuple = (IndexTuple) tp;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/hash/hashinsert.c,v 1.17 1999/07/15 23:02:54 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/hash/hashinsert.c,v 1.18 1999/07/19 07:07:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
itemsz = IndexTupleDSize(hitem->hash_itup)
+ (sizeof(HashItemData) - sizeof(IndexTupleData));
- itemsz = DOUBLEALIGN(itemsz);
+ itemsz = MAXALIGN(itemsz);
while (PageGetFreeSpace(page) < itemsz)
{
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/hash/hashovfl.c,v 1.24 1999/07/17 20:16:38 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/hash/hashovfl.c,v 1.25 1999/07/19 07:07:16 momjian Exp $
*
* NOTES
* Overflow pages look like ordinary relation pages.
hitem = (HashItem) PageGetItem(rpage, PageGetItemId(rpage, roffnum));
itemsz = IndexTupleDSize(hitem->hash_itup)
+ (sizeof(HashItemData) - sizeof(IndexTupleData));
- itemsz = DOUBLEALIGN(itemsz);
+ itemsz = MAXALIGN(itemsz);
/*
* walk up the bucket chain, looking for a page big enough for
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/hash/hashpage.c,v 1.24 1999/07/17 20:16:39 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/hash/hashpage.c,v 1.25 1999/07/19 07:07:17 momjian Exp $
*
* NOTES
* Postgres hash pages look like ordinary relation pages. The opaque
for (i = metap->hashm_bshift; i > 0; --i)
{
if ((1 << i) < (metap->hashm_bsize -
- (DOUBLEALIGN(sizeof(PageHeaderData)) +
- DOUBLEALIGN(sizeof(HashPageOpaqueData)))))
+ (MAXALIGN(sizeof(PageHeaderData)) +
+ MAXALIGN(sizeof(HashPageOpaqueData)))))
break;
}
Assert(i);
itemsz = IndexTupleDSize(hitem->hash_itup)
+ (sizeof(HashItemData) - sizeof(IndexTupleData));
- itemsz = DOUBLEALIGN(itemsz);
+ itemsz = MAXALIGN(itemsz);
if (PageGetFreeSpace(npage) < itemsz)
{
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/hash/hashutil.c,v 1.21 1999/07/17 20:16:39 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/hash/hashutil.c,v 1.22 1999/07/19 07:07:17 momjian Exp $
*
*-------------------------------------------------------------------------
*/
Assert(((PageHeader) (page))->pd_lower >= (sizeof(PageHeaderData) - sizeof(ItemIdData)));
#if 1
Assert(((PageHeader) (page))->pd_upper <=
- (BLCKSZ - DOUBLEALIGN(sizeof(HashPageOpaqueData))));
+ (BLCKSZ - MAXALIGN(sizeof(HashPageOpaqueData))));
Assert(((PageHeader) (page))->pd_special ==
- (BLCKSZ - DOUBLEALIGN(sizeof(HashPageOpaqueData))));
+ (BLCKSZ - MAXALIGN(sizeof(HashPageOpaqueData))));
Assert(((PageHeader) (page))->pd_opaque.od_pagesize == BLCKSZ);
#endif
if (flags)
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.52 1999/07/17 20:16:39 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.53 1999/07/19 07:07:18 momjian Exp $
*
*
* INTERFACE ROUTINES
HEAP_XMAX_INVALID | HEAP_MARKED_FOR_UPDATE);
/* insert new item */
- if ((unsigned) DOUBLEALIGN(newtup->t_len) <= PageGetFreeSpace((Page) dp))
+ if ((unsigned) MAXALIGN(newtup->t_len) <= PageGetFreeSpace((Page) dp))
RelationPutHeapTuple(relation, buffer, newtup);
else
{
*
*
* IDENTIFICATION
- * $Id: hio.c,v 1.25 1999/07/16 04:58:27 momjian Exp $
+ * $Id: hio.c,v 1.26 1999/07/19 07:07:18 momjian Exp $
*
*-------------------------------------------------------------------------
*/
IncrHeapAccessStat(global_RelationPutHeapTuple);
pageHeader = (Page) BufferGetPage(buffer);
- len = (unsigned) DOUBLEALIGN(tuple->t_len); /* be conservative */
+ len = (unsigned) MAXALIGN(tuple->t_len); /* be conservative */
Assert((int) len <= PageGetFreeSpace(pageHeader));
offnum = PageAddItem((Page) pageHeader, (Item) tuple->t_data,
LockBuffer(buffer, BUFFER_LOCK_EXCLUSIVE);
pageHeader = (Page) BufferGetPage(buffer);
- len = (unsigned) DOUBLEALIGN(tuple->t_len); /* be conservative */
+ len = (unsigned) MAXALIGN(tuple->t_len); /* be conservative */
/*
* Note that this is true if the above returned a bogus page, which it
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.48 1999/07/17 20:16:42 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.49 1999/07/19 07:07:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
itemsz = IndexTupleDSize(btitem->bti_itup)
+ (sizeof(BTItemData) - sizeof(IndexTupleData));
- itemsz = DOUBLEALIGN(itemsz); /* be safe, PageAddItem will do
+ itemsz = MAXALIGN(itemsz); /* be safe, PageAddItem will do
* this but we need to be
* consistent */
if (currsize > maxsize)
maxsize = currsize;
maxsize += sizeof(PageHeaderData) +
- DOUBLEALIGN(sizeof(BTPageOpaqueData));
+ MAXALIGN(sizeof(BTPageOpaqueData));
if (maxsize >= PageGetPageSize(page) / 2)
do_split = true;
}
maxoff = PageGetMaxOffsetNumber(page);
llimit = PageGetPageSize(page) - sizeof(PageHeaderData) -
- DOUBLEALIGN(sizeof(BTPageOpaqueData))
+ MAXALIGN(sizeof(BTPageOpaqueData))
+sizeof(ItemIdData);
llimit /= 2;
firstright = _bt_findsplitloc(rel, page, start, maxoff, llimit);
* then we must forse insertion.
*/
if (!parent_chained &&
- DOUBLEALIGN(IndexTupleDSize(lowLeftItem->bti_itup)) ==
- DOUBLEALIGN(IndexTupleDSize(stack->bts_btitem->bti_itup)))
+ MAXALIGN(IndexTupleDSize(lowLeftItem->bti_itup)) ==
+ MAXALIGN(IndexTupleDSize(stack->bts_btitem->bti_itup)))
{
_bt_updateitem(rel, keysz, pbuf,
stack->bts_btitem, lowLeftItem);
/* add passed hikey */
itemsz = IndexTupleDSize(hikey->bti_itup)
+ (sizeof(BTItemData) - sizeof(IndexTupleData));
- itemsz = DOUBLEALIGN(itemsz);
+ itemsz = MAXALIGN(itemsz);
if (PageAddItem(page, (Item) hikey, itemsz, P_HIKEY, LP_USED) == InvalidOffsetNumber)
elog(FATAL, "btree: failed to add hikey in _bt_shift");
pfree(hikey);
/* add btitem */
itemsz = IndexTupleDSize(btitem->bti_itup)
+ (sizeof(BTItemData) - sizeof(IndexTupleData));
- itemsz = DOUBLEALIGN(itemsz);
+ itemsz = MAXALIGN(itemsz);
if (PageAddItem(page, (Item) btitem, itemsz, P_FIRSTKEY, LP_USED) == InvalidOffsetNumber)
elog(FATAL, "btree: failed to add firstkey in _bt_shift");
pfree(btitem);
*
*
* IDENTIFICATION
- * $Id: nbtsort.c,v 1.45 1999/07/17 20:16:43 momjian Exp $
+ * $Id: nbtsort.c,v 1.46 1999/07/19 07:07:19 momjian Exp $
*
* NOTES
*
* are potentially reading a bunch of zeroes off of disk in many
* cases.
*
- * BTItems are packed in and DOUBLEALIGN'd.
+ * BTItems are packed in and MAXALIGN'd.
*
* the fd should not be going out to disk, strictly speaking, but it's
* the only thing like that so i'm not going to worry about wasting a
return (BTItem) NULL;
bti = (BTItem) *pos;
itemsz = BTITEMSZ(bti);
- *pos += DOUBLEALIGN(itemsz);
+ *pos += MAXALIGN(itemsz);
return bti;
}
{
memcpy(tape->bttb_data + tape->bttb_top, item, itemsz);
++tape->bttb_ntup;
- tape->bttb_top += DOUBLEALIGN(itemsz);
+ tape->bttb_top += MAXALIGN(itemsz);
}
/*-------------------------------------------------------------------------
itape = btspool->bts_itape[btspool->bts_tape];
itemsz = BTITEMSZ(btitem);
- itemsz = DOUBLEALIGN(itemsz);
+ itemsz = MAXALIGN(itemsz);
/*
* if this buffer is too full for this BTItemData, or if we have run
* BTItemDatas in the order dictated by the sorted array of
* BTItems, not the original order.
*
- * (since everything was DOUBLEALIGN'd and is all on a single tape
+ * (since everything was MAXALIGN'd and is all on a single tape
* block, everything had *better* still fit on one tape block..)
*/
otape = btspool->bts_otape[btspool->bts_tape];
{
bti = parray[i].btsk_item;
btisz = BTITEMSZ(bti);
- btisz = DOUBLEALIGN(btisz);
+ btisz = MAXALIGN(btisz);
_bt_tapeadd(otape, bti, btisz);
#if defined(FASTBUILD_DEBUG) && defined(FASTBUILD_SPOOL)
{
pgspc = PageGetFreeSpace(npage);
btisz = BTITEMSZ(bti);
- btisz = DOUBLEALIGN(btisz);
+ btisz = MAXALIGN(btisz);
if (pgspc < btisz)
{
Buffer obuf = nbuf;
if (bti != (BTItem) NULL)
{
btisz = BTITEMSZ(bti);
- btisz = DOUBLEALIGN(btisz);
+ btisz = MAXALIGN(btisz);
if (doleaf)
{
_bt_buildadd(index, state, bti, BTP_LEAF);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.114 1999/07/17 20:16:54 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.115 1999/07/19 07:07:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
to_item = i;
to_vpd = fraged_pages->vpl_pagedesc[to_item];
}
- to_vpd->vpd_free -= DOUBLEALIGN(tlen);
+ to_vpd->vpd_free -= MAXALIGN(tlen);
if (to_vpd->vpd_offsets_used >= to_vpd->vpd_offsets_free)
- to_vpd->vpd_free -= DOUBLEALIGN(sizeof(ItemIdData));
+ to_vpd->vpd_free -= MAXALIGN(sizeof(ItemIdData));
(to_vpd->vpd_offsets_used)++;
if (free_vtmove == 0)
{
vc_enough_space(VPageDescr vpd, Size len)
{
- len = DOUBLEALIGN(len);
+ len = MAXALIGN(len);
if (len > vpd->vpd_free)
return false;
return true; /* and len <= free_space */
/* ok. noff_usd >= noff_free and so we'll have to allocate new itemid */
- if (len + DOUBLEALIGN(sizeof(ItemIdData)) <= vpd->vpd_free)
+ if (len + MAXALIGN(sizeof(ItemIdData)) <= vpd->vpd_free)
return true;
return false;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.34 1999/07/17 20:17:36 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.35 1999/07/19 07:07:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
(rulename, ev_type, ev_class, ev_attr, ev_action, ev_qual, is_instead) VALUES \
('%s', %d::char, %u::oid, %d::int2, '%s'::text, '%s'::text, \
'%s'::bool);";
- if (sizeof(FormData_pg_rewrite) + strlen(actionbuf) +
- strlen(qualbuf) > MaxAttrSize)
+ if (MAXALIGN(sizeof(FormData_pg_rewrite)) +
+ MAXALIGN(strlen(actionbuf)) +
+ MAXALIGN(strlen(qualbuf)) > MaxAttrSize)
elog(ERROR, "DefineQueryRewrite: rule plan string too big.");
sprintf(rulebuf, template,
rulname, evtype, eventrel_oid, evslot_index, actionbuf,
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.57 1999/07/17 20:17:45 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.58 1999/07/19 07:07:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
*/
#define IFREESPC(p) (PageGetFreeSpace(p) - \
- DOUBLEALIGN(offsetof(HeapTupleHeaderData,t_bits)) - \
- DOUBLEALIGN(sizeof(struct varlena) + sizeof(int32)) - \
+ MAXALIGN(offsetof(HeapTupleHeaderData,t_bits)) - \
+ MAXALIGN(sizeof(struct varlena) + sizeof(int32)) - \
sizeof(double))
#define IMAXBLK 8092
#define IMINBLK 512
/* compute tuple size -- no nulls */
hoff = offsetof(HeapTupleHeaderData, t_bits);
- hoff = DOUBLEALIGN(hoff);
+ hoff = MAXALIGN(hoff);
/* add in olastbyte, varlena.vl_len, varlena.vl_dat */
tupsize = hoff + (2 * sizeof(int32)) + nwrite;
- tupsize = DOUBLEALIGN(tupsize);
+ tupsize = MAXALIGN(tupsize);
/*
* Allocate the tuple on the page, violating the page abstraction.
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/page/bufpage.c,v 1.26 1999/07/17 20:17:48 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/page/bufpage.c,v 1.27 1999/07/19 07:07:24 momjian Exp $
*
*-------------------------------------------------------------------------
*/
Assert(pageSize >
specialSize + sizeof(PageHeaderData) - sizeof(ItemIdData));
- specialSize = DOUBLEALIGN(specialSize);
+ specialSize = MAXALIGN(specialSize);
p->pd_lower = sizeof(PageHeaderData) - sizeof(ItemIdData);
p->pd_upper = pageSize - specialSize;
else
lower = ((PageHeader) page)->pd_lower;
- alignedSize = DOUBLEALIGN(size);
+ alignedSize = MAXALIGN(size);
upper = ((PageHeader) page)->pd_upper - alignedSize;
/* clear out the middle */
size = (pageSize - sizeof(PageHeaderData)) + sizeof(ItemIdData);
- size -= DOUBLEALIGN(specialSize);
+ size -= MAXALIGN(specialSize);
MemSet((char *) &(thdr->pd_linp[0]), 0, size);
/* set high, low water marks */
thdr->pd_lower = sizeof(PageHeaderData) - sizeof(ItemIdData);
- thdr->pd_upper = pageSize - DOUBLEALIGN(specialSize);
+ thdr->pd_upper = pageSize - MAXALIGN(specialSize);
return temp;
}
for (i = 0, itemidptr = itemidbase; i < nused; i++, itemidptr++)
{
lp = ((PageHeader) page)->pd_linp + itemidptr->offsetindex;
- alignedSize = DOUBLEALIGN((*lp).lp_len);
+ alignedSize = MAXALIGN((*lp).lp_len);
upper = ((PageHeader) page)->pd_upper - alignedSize;
memmove((char *) page + upper,
(char *) page + (*lp).lp_off,
tup = PageGetItemId(page, offnum);
size = ItemIdGetLength(tup);
- size = DOUBLEALIGN(size);
+ size = MAXALIGN(size);
/* location of deleted tuple data */
locn = (char *) (page + ItemIdGetOffset(tup));
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.47 1999/07/17 20:17:53 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.48 1999/07/19 07:07:25 momjian Exp $
*
*-------------------------------------------------------------------------
*/
if (values[i])
{
if (typalign == 'd')
- *nbytes += DOUBLEALIGN(*(int32 *) values[i]);
+ *nbytes += MAXALIGN(*(int32 *) values[i]);
else
*nbytes += INTALIGN(*(int32 *) values[i]);
}
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: hash.h,v 1.27 1999/07/16 17:07:26 momjian Exp $
+ * $Id: hash.h,v 1.28 1999/07/19 07:07:27 momjian Exp $
*
* NOTES
* modeled after Margo Seltzer's hash implementation for unix.
#define BMPGSZ_BYTE(metap) ((metap)->hashm_bmsize)
#define BMPGSZ_BIT(metap) ((metap)->hashm_bmsize << BYTE_TO_BIT)
#define HashPageGetBitmap(pg) \
- ((uint32 *) (((char *) (pg)) + DOUBLEALIGN(sizeof(PageHeaderData))))
+ ((uint32 *) (((char *) (pg)) + MAXALIGN(sizeof(PageHeaderData))))
/*
* The number of bits in an ovflpage bitmap which
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: htup.h,v 1.24 1999/07/15 23:03:34 momjian Exp $
+ * $Id: htup.h,v 1.25 1999/07/19 07:07:28 momjian Exp $
*
*-------------------------------------------------------------------------
*/
typedef HeapTupleData *HeapTuple;
-#define HEAPTUPLESIZE DOUBLEALIGN(sizeof(HeapTupleData))
+#define HEAPTUPLESIZE MAXALIGN(sizeof(HeapTupleData))
/* ----------------
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: itup.h,v 1.20 1999/07/16 17:07:27 momjian Exp $
+ * $Id: itup.h,v 1.21 1999/07/19 07:07:28 momjian Exp $
*
*-------------------------------------------------------------------------
*/
) \
: \
( \
- (Size)DOUBLEALIGN(sizeof(IndexTupleData) + sizeof(IndexAttributeBitMapData)) \
+ (Size)MAXALIGN(sizeof(IndexTupleData) + sizeof(IndexAttributeBitMapData)) \
) \
)
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: array.h,v 1.20 1999/07/17 20:18:35 momjian Exp $
+ * $Id: array.h,v 1.21 1999/07/19 07:07:29 momjian Exp $
*
* NOTES
* XXX the data array should be LONGALIGN'd -- notice that the array
*/
#define ARR_DATA_PTR(a) \
(((char *) a) + \
- DOUBLEALIGN(sizeof(ArrayType) + 2 * (sizeof(int) * (a)->ndim)))
+ MAXALIGN(sizeof(ArrayType) + 2 * (sizeof(int) * (a)->ndim)))
/*
* The total array header size for an array of dimension n (in bytes).
*/
#define ARR_OVERHEAD(n) \
- (DOUBLEALIGN(sizeof(ArrayType) + 2 * (n) * sizeof(int)))
+ (MAXALIGN(sizeof(ArrayType) + 2 * (n) * sizeof(int)))
/*------------------------------------------------------------------------
* Miscellaneous helper definitions and routines for arrayfuncs.c