aboutsummaryrefslogtreecommitdiff
path: root/db2/btree/bt_split.c
diff options
context:
space:
mode:
Diffstat (limited to 'db2/btree/bt_split.c')
-rw-r--r--db2/btree/bt_split.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/db2/btree/bt_split.c b/db2/btree/bt_split.c
index 219d486dc5..da9417c781 100644
--- a/db2/btree/bt_split.c
+++ b/db2/btree/bt_split.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1996, 1997
+ * Copyright (c) 1996, 1997, 1998
* Sleepycat Software. All rights reserved.
*/
/*
@@ -44,7 +44,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)bt_split.c 10.18 (Sleepycat) 11/23/97";
+static const char sccsid[] = "@(#)bt_split.c 10.23 (Sleepycat) 5/23/98";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
@@ -52,8 +52,6 @@ static const char sccsid[] = "@(#)bt_split.c 10.18 (Sleepycat) 11/23/97";
#include <errno.h>
#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
#endif
@@ -168,8 +166,10 @@ __bam_root(dbp, cp)
t = dbp->internal;
/* Yeah, right. */
- if (cp->page->level >= MAXBTREELEVEL)
- return (ENOSPC);
+ if (cp->page->level >= MAXBTREELEVEL) {
+ ret = ENOSPC;
+ goto err;
+ }
/* Create new left and right pages for the split. */
lp = rp = NULL;
@@ -237,18 +237,16 @@ __bam_page(dbp, pp, cp)
DB *dbp;
EPG *pp, *cp;
{
- BTREE *t;
DB_LOCK tplock;
PAGE *lp, *rp, *tp;
int ret;
- t = dbp->internal;
lp = rp = tp = NULL;
ret = -1;
/* Create new right page for the split. */
if ((ret = __bam_new(dbp, TYPE(cp->page), &rp)) != 0)
- return (ret);
+ goto err;
P_INIT(rp, dbp->pgsize, rp->pgno,
ISINTERNAL(cp->page) ? PGNO_INVALID : cp->page->pgno,
ISINTERNAL(cp->page) ? PGNO_INVALID : cp->page->next_pgno,
@@ -259,7 +257,7 @@ __bam_page(dbp, pp, cp)
ret = ENOMEM;
goto err;
}
-#ifdef DEBUG
+#ifdef DIAGNOSTIC
memset(lp, 0xff, dbp->pgsize);
#endif
P_INIT(lp, dbp->pgsize, cp->page->pgno,
@@ -906,13 +904,13 @@ __bam_copy(dbp, pp, cp, nxt, stop)
PAGE *pp, *cp;
u_int32_t nxt, stop;
{
- db_indx_t dup, nbytes, off;
+ db_indx_t nbytes, off;
/*
* Copy the rest of the data to the right page. Nxt is the next
* offset placed on the target page.
*/
- for (dup = off = 0; nxt < stop; ++nxt, ++NUM_ENT(cp), ++off) {
+ for (off = 0; nxt < stop; ++nxt, ++NUM_ENT(cp), ++off) {
switch (TYPE(pp)) {
case P_IBTREE:
if (B_TYPE(GET_BINTERNAL(pp, nxt)->type) == B_KEYDATA)