summaryrefslogtreecommitdiffstats
path: root/lib/libc/db/hash/hash_bigkey.c
diff options
context:
space:
mode:
authorpst <pst@FreeBSD.org>1996-02-27 01:59:15 +0000
committerpst <pst@FreeBSD.org>1996-02-27 01:59:15 +0000
commitc2306789fe98946429af7462a2fd453454034a79 (patch)
treee6563df097216e3af35d87ac698b2ea9eb3f5f75 /lib/libc/db/hash/hash_bigkey.c
parent5476eae499a3e1c3530620c0ebc3a69ffb2f25ba (diff)
downloadFreeBSD-src-c2306789fe98946429af7462a2fd453454034a79.zip
FreeBSD-src-c2306789fe98946429af7462a2fd453454034a79.tar.gz
Import updated Berkeley DB into CSRG branch
Diffstat (limited to 'lib/libc/db/hash/hash_bigkey.c')
-rw-r--r--lib/libc/db/hash/hash_bigkey.c76
1 files changed, 38 insertions, 38 deletions
diff --git a/lib/libc/db/hash/hash_bigkey.c b/lib/libc/db/hash/hash_bigkey.c
index b747fbc..578314a 100644
--- a/lib/libc/db/hash/hash_bigkey.c
+++ b/lib/libc/db/hash/hash_bigkey.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 1990, 1993
+ * Copyright (c) 1990, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
@@ -35,7 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)hash_bigkey.c 8.2 (Berkeley) 2/21/94";
+static char sccsid[] = "@(#)hash_bigkey.c 8.3 (Berkeley) 5/31/94";
#endif /* LIBC_SCCS and not lint */
/*
@@ -90,13 +90,13 @@ __big_insert(hashp, bufp, key, val)
BUFHEAD *bufp;
const DBT *key, *val;
{
- register u_short *p;
+ register u_int16_t *p;
int key_size, n, val_size;
- u_short space, move_bytes, off;
+ u_int16_t space, move_bytes, off;
char *cp, *key_data, *val_data;
cp = bufp->page; /* Character pointer of p. */
- p = (u_short *)cp;
+ p = (u_int16_t *)cp;
key_data = (char *)key->data;
key_size = key->size;
@@ -134,7 +134,7 @@ __big_insert(hashp, bufp, key, val)
OFFSET(p) = off;
} else
p[n - 2] = FULL_KEY;
- p = (u_short *)bufp->page;
+ p = (u_int16_t *)bufp->page;
cp = bufp->page;
bufp->flags |= BUF_MOD;
}
@@ -164,7 +164,7 @@ __big_insert(hashp, bufp, key, val)
if (!bufp)
return (-1);
cp = bufp->page;
- p = (u_short *)cp;
+ p = (u_int16_t *)cp;
} else
p[n] = FULL_KEY_DATA;
bufp->flags |= BUF_MOD;
@@ -189,12 +189,12 @@ __big_delete(hashp, bufp)
BUFHEAD *bufp;
{
register BUFHEAD *last_bfp, *rbufp;
- u_short *bp, pageno;
+ u_int16_t *bp, pageno;
int key_done, n;
rbufp = bufp;
last_bfp = NULL;
- bp = (u_short *)bufp->page;
+ bp = (u_int16_t *)bufp->page;
pageno = 0;
key_done = 0;
@@ -217,7 +217,7 @@ __big_delete(hashp, bufp)
last_bfp = rbufp;
if (!rbufp)
return (-1); /* Error. */
- bp = (u_short *)rbufp->page;
+ bp = (u_int16_t *)rbufp->page;
}
/*
@@ -232,7 +232,7 @@ __big_delete(hashp, bufp)
pageno = bp[n - 1];
/* Now, bp is the first page of the pair. */
- bp = (u_short *)bufp->page;
+ bp = (u_int16_t *)bufp->page;
if (n > 2) {
/* There is an overflow page. */
bp[1] = pageno;
@@ -270,13 +270,13 @@ __find_bigpair(hashp, bufp, ndx, key, size)
char *key;
int size;
{
- register u_short *bp;
+ register u_int16_t *bp;
register char *p;
int ksize;
- u_short bytes;
+ u_int16_t bytes;
char *kkey;
- bp = (u_short *)bufp->page;
+ bp = (u_int16_t *)bufp->page;
p = bufp->page;
ksize = size;
kkey = key;
@@ -292,7 +292,7 @@ __find_bigpair(hashp, bufp, ndx, key, size)
if (!bufp)
return (-3);
p = bufp->page;
- bp = (u_short *)p;
+ bp = (u_int16_t *)p;
ndx = 1;
}
@@ -314,17 +314,17 @@ __find_bigpair(hashp, bufp, ndx, key, size)
* of the pair; 0 if there isn't any (i.e. big pair is the last key in the
* bucket)
*/
-extern u_short
+extern u_int16_t
__find_last_page(hashp, bpp)
HTAB *hashp;
BUFHEAD **bpp;
{
BUFHEAD *bufp;
- u_short *bp, pageno;
+ u_int16_t *bp, pageno;
int n;
bufp = *bpp;
- bp = (u_short *)bufp->page;
+ bp = (u_int16_t *)bufp->page;
for (;;) {
n = bp[0];
@@ -341,7 +341,7 @@ __find_last_page(hashp, bpp)
bufp = __get_buf(hashp, pageno, bufp, 0);
if (!bufp)
return (0); /* Need to indicate an error! */
- bp = (u_short *)bufp->page;
+ bp = (u_int16_t *)bufp->page;
}
*bpp = bufp;
@@ -364,15 +364,15 @@ __big_return(hashp, bufp, ndx, val, set_current)
int set_current;
{
BUFHEAD *save_p;
- u_short *bp, len, off, save_addr;
+ u_int16_t *bp, len, off, save_addr;
char *tp;
- bp = (u_short *)bufp->page;
+ bp = (u_int16_t *)bufp->page;
while (bp[ndx + 1] == PARTIAL_KEY) {
bufp = __get_buf(hashp, bp[bp[0] - 1], bufp, 0);
if (!bufp)
return (-1);
- bp = (u_short *)bufp->page;
+ bp = (u_int16_t *)bufp->page;
ndx = 1;
}
@@ -380,7 +380,7 @@ __big_return(hashp, bufp, ndx, val, set_current)
bufp = __get_buf(hashp, bp[bp[0] - 1], bufp, 0);
if (!bufp)
return (-1);
- bp = (u_short *)bufp->page;
+ bp = (u_int16_t *)bufp->page;
save_p = bufp;
save_addr = save_p->addr;
off = bp[1];
@@ -401,7 +401,7 @@ __big_return(hashp, bufp, ndx, val, set_current)
bufp = __get_buf(hashp, bp[bp[0] - 1], bufp, 0);
if (!bufp)
return (-1);
- bp = (u_short *)bufp->page;
+ bp = (u_int16_t *)bufp->page;
} else {
/* The data is all on one page. */
tp = (char *)bp;
@@ -420,7 +420,7 @@ __big_return(hashp, bufp, ndx, val, set_current)
if (!hashp->cpage)
return (-1);
hashp->cndx = 1;
- if (!((u_short *)
+ if (!((u_int16_t *)
hashp->cpage->page)[0]) {
hashp->cbucket++;
hashp->cpage = NULL;
@@ -452,14 +452,14 @@ collect_data(hashp, bufp, len, set)
BUFHEAD *bufp;
int len, set;
{
- register u_short *bp;
+ register u_int16_t *bp;
register char *p;
BUFHEAD *xbp;
- u_short save_addr;
+ u_int16_t save_addr;
int mylen, totlen;
p = bufp->page;
- bp = (u_short *)p;
+ bp = (u_int16_t *)p;
mylen = hashp->BSIZE - bp[1];
save_addr = bufp->addr;
@@ -479,7 +479,7 @@ collect_data(hashp, bufp, len, set)
__get_buf(hashp, bp[bp[0] - 1], bufp, 0);
if (!hashp->cpage)
return (-1);
- else if (!((u_short *)hashp->cpage->page)[0]) {
+ else if (!((u_int16_t *)hashp->cpage->page)[0]) {
hashp->cbucket++;
hashp->cpage = NULL;
}
@@ -531,10 +531,10 @@ collect_key(hashp, bufp, len, val, set)
BUFHEAD *xbp;
char *p;
int mylen, totlen;
- u_short *bp, save_addr;
+ u_int16_t *bp, save_addr;
p = bufp->page;
- bp = (u_short *)p;
+ bp = (u_int16_t *)p;
mylen = hashp->BSIZE - bp[1];
save_addr = bufp->addr;
@@ -573,15 +573,15 @@ __big_split(hashp, op, np, big_keyp, addr, obucket, ret)
/* Pointer to first page containing the big key/data */
BUFHEAD *big_keyp;
int addr; /* Address of big_keyp */
- u_int obucket;/* Old Bucket */
+ u_int32_t obucket;/* Old Bucket */
SPLIT_RETURN *ret;
{
register BUFHEAD *tmpp;
- register u_short *tp;
+ register u_int16_t *tp;
BUFHEAD *bp;
DBT key, val;
- u_int change;
- u_short free_space, n, off;
+ u_int32_t change;
+ u_int16_t free_space, n, off;
bp = big_keyp;
@@ -613,14 +613,14 @@ __big_split(hashp, op, np, big_keyp, addr, obucket, ret)
(tmpp->ovfl ? tmpp->ovfl->addr : 0), (bp ? bp->addr : 0));
#endif
tmpp->ovfl = bp; /* one of op/np point to big_keyp */
- tp = (u_short *)tmpp->page;
+ tp = (u_int16_t *)tmpp->page;
#ifdef DEBUG
assert(FREESPACE(tp) >= OVFLSIZE);
#endif
n = tp[0];
off = OFFSET(tp);
free_space = FREESPACE(tp);
- tp[++n] = (u_short)addr;
+ tp[++n] = (u_int16_t)addr;
tp[++n] = OVFLPAGE;
tp[0] = n;
OFFSET(tp) = off;
@@ -636,7 +636,7 @@ __big_split(hashp, op, np, big_keyp, addr, obucket, ret)
ret->newp = np;
ret->oldp = op;
- tp = (u_short *)big_keyp->page;
+ tp = (u_int16_t *)big_keyp->page;
big_keyp->flags |= BUF_MOD;
if (tp[0] > 2) {
/*
OpenPOWER on IntegriCloud