diff options
author | Marc G. Fournier <scrappy@hub.org> | 1999-08-02 05:25:27 +0000 |
---|---|---|
committer | Marc G. Fournier <scrappy@hub.org> | 1999-08-02 05:25:27 +0000 |
commit | 9a8aeb23a19ee6833480d4c12719d9fd26ad8571 (patch) | |
tree | c97d5f26e89cc9d33c5be420a5e7688835644c77 /src/backend/access/nbtree/nbtinsert.c | |
parent | 62d146bdcd784280b573acd8af52488e66e212cf (diff) |
Another 'mega-commit' of back-patches ...
- integrating the #include file cleanup that Bruce recently did
- got the CPU change to adt/Makefile
- changing DOUBLEALIGN -> MAXALIGN
Diffstat (limited to 'src/backend/access/nbtree/nbtinsert.c')
-rw-r--r-- | src/backend/access/nbtree/nbtinsert.c | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/src/backend/access/nbtree/nbtinsert.c b/src/backend/access/nbtree/nbtinsert.c index cd3de2e26b0..b894bcc2931 100644 --- a/src/backend/access/nbtree/nbtinsert.c +++ b/src/backend/access/nbtree/nbtinsert.c @@ -7,25 +7,16 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.42 1999/05/25 22:04:11 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.42.2.1 1999/08/02 05:24:40 scrappy Exp $ * *------------------------------------------------------------------------- */ -#include <postgres.h> +#include "postgres.h" -#include <utils/memutils.h> -#include <storage/bufpage.h> -#include <access/nbtree.h> -#include <access/heapam.h> -#include <access/xact.h> -#include <fmgr.h> +#include "access/heapam.h" +#include "access/nbtree.h" -#ifndef HAVE_MEMMOVE -#include <regex/utils.h> -#else -#include <string.h> -#endif static InsertIndexResult _bt_insertonpg(Relation rel, Buffer buf, BTStack stack, int keysz, ScanKey scankey, BTItem btitem, BTItem afteritem); static Buffer _bt_split(Relation rel, Buffer buf, OffsetNumber firstright); @@ -272,7 +263,7 @@ _bt_insertonpg(Relation rel, 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 */ @@ -378,7 +369,7 @@ _bt_insertonpg(Relation rel, if (currsize > maxsize) maxsize = currsize; maxsize += sizeof(PageHeaderData) + - DOUBLEALIGN(sizeof(BTPageOpaqueData)); + MAXALIGN(sizeof(BTPageOpaqueData)); if (maxsize >= PageGetPageSize(page) / 2) do_split = true; } @@ -469,7 +460,7 @@ _bt_insertonpg(Relation rel, 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); @@ -698,8 +689,8 @@ l_spl: ; * 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); @@ -1600,7 +1591,7 @@ _bt_shift(Relation rel, Buffer buf, BTStack stack, int keysz, /* 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); @@ -1608,7 +1599,7 @@ _bt_shift(Relation rel, Buffer buf, BTStack stack, int keysz, /* 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); |