* Copyright (c) 1990 The Regents of the University of California.
* This code is derived from software contributed to Berkeley by
* %sccs.include.redist.c%
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid
[] = "@(#)bt_stack.c 5.4 (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */
* When a page splits, a new record has to be inserted into its parent page.
* This page may have to split as well, all the way up to the root. Since
* parent pointers in each page would be expensive, we maintain a stack of
* parent pages as we descend the tree.
* This is a concurrency problem -- if user a builds a stack, then user b
* splits the tree, then user a tries to split the tree, there's a new level
* in the tree that user a doesn't know about.
* __BT_PUSH -- Push parent page info onto the stack (LIFO).
__bt_push(t
, pgno
, index
)
if (t
->bt_sp
== t
->bt_maxstack
) {
if ((t
->bt_stack
= realloc(t
->bt_stack
,
t
->bt_maxstack
* sizeof(EPGNO
))) == NULL
) {
t
->bt_stack
[t
->bt_sp
].pgno
= pgno
;
t
->bt_stack
[t
->bt_sp
].index
= index
;