diff options
author | peter <peter@FreeBSD.org> | 1996-10-19 01:34:25 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1996-10-19 01:34:25 +0000 |
commit | 0af664a5bd57fd63585617ca5b86b7140ab3219c (patch) | |
tree | 3bc59e4e3fa6594a4f87962a91aa8e78e247eebd /lib/libc/db/hash | |
parent | d0ca57d30d45555b25b21e08b2ed1c3676d33533 (diff) | |
download | FreeBSD-src-0af664a5bd57fd63585617ca5b86b7140ab3219c.zip FreeBSD-src-0af664a5bd57fd63585617ca5b86b7140ab3219c.tar.gz |
Back out most of the last backout. :-) Guido removed the 1.1.1.1->1.1.1.2
changes from the vendor branch as well, backing the db-1.82 changes.
This file should now be the same as it was in rev 1.1.1.2.
Diffstat (limited to 'lib/libc/db/hash')
-rw-r--r-- | lib/libc/db/hash/hash_buf.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/lib/libc/db/hash/hash_buf.c b/lib/libc/db/hash/hash_buf.c index 1362c83..92e1f93 100644 --- a/lib/libc/db/hash/hash_buf.c +++ b/lib/libc/db/hash/hash_buf.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_buf.c 8.2 (Berkeley) 2/21/94"; +static char sccsid[] = "@(#)hash_buf.c 8.5 (Berkeley) 7/15/94"; #endif /* LIBC_SCCS and not lint */ /* @@ -57,8 +57,10 @@ static char sccsid[] = "@(#)hash_buf.c 8.2 (Berkeley) 2/21/94"; #include <sys/param.h> #include <errno.h> +#include <stddef.h> #include <stdio.h> #include <stdlib.h> + #ifdef DEBUG #include <assert.h> #endif @@ -68,7 +70,7 @@ static char sccsid[] = "@(#)hash_buf.c 8.2 (Berkeley) 2/21/94"; #include "page.h" #include "extern.h" -static BUFHEAD *newbuf __P((HTAB *, u_int, BUFHEAD *)); +static BUFHEAD *newbuf __P((HTAB *, u_int32_t, BUFHEAD *)); /* Unlink B from its place in the lru */ #define BUF_REMOVE(B) { \ @@ -102,12 +104,12 @@ static BUFHEAD *newbuf __P((HTAB *, u_int, BUFHEAD *)); extern BUFHEAD * __get_buf(hashp, addr, prev_bp, newpage) HTAB *hashp; - u_int addr; + u_int32_t addr; BUFHEAD *prev_bp; int newpage; /* If prev_bp set, indicates a new overflow page. */ { register BUFHEAD *bp; - register u_int is_disk_mask; + register u_int32_t is_disk_mask; register int is_disk, segment_ndx; SEGMENT segp; @@ -140,7 +142,7 @@ __get_buf(hashp, addr, prev_bp, newpage) return (NULL); if (!prev_bp) segp[segment_ndx] = - (BUFHEAD *)((u_int)bp | is_disk_mask); + (BUFHEAD *)((ptrdiff_t)bp | is_disk_mask); } else { BUF_REMOVE(bp); MRU_INSERT(bp); @@ -157,7 +159,7 @@ __get_buf(hashp, addr, prev_bp, newpage) static BUFHEAD * newbuf(hashp, addr, prev_bp) HTAB *hashp; - u_int addr; + u_int32_t addr; BUFHEAD *prev_bp; { register BUFHEAD *bp; /* The buffer we're going to use */ @@ -165,7 +167,7 @@ newbuf(hashp, addr, prev_bp) register BUFHEAD *next_xbp; SEGMENT segp; int segment_ndx; - u_short oaddr, *shortp; + u_int16_t oaddr, *shortp; oaddr = 0; bp = LRU; @@ -177,10 +179,16 @@ newbuf(hashp, addr, prev_bp) /* Allocate a new one */ if ((bp = (BUFHEAD *)malloc(sizeof(BUFHEAD))) == NULL) return (NULL); +#ifdef PURIFY + memset(bp, 0xff, sizeof(BUFHEAD)); +#endif if ((bp->page = (char *)malloc(hashp->BSIZE)) == NULL) { free(bp); return (NULL); } +#ifdef PURIFY + memset(bp->page, 0xff, hashp->BSIZE); +#endif if (hashp->nbufs) hashp->nbufs--; } else { @@ -195,7 +203,7 @@ newbuf(hashp, addr, prev_bp) * Set oaddr before __put_page so that you get it * before bytes are swapped. */ - shortp = (u_short *)bp->page; + shortp = (u_int16_t *)bp->page; if (shortp[0]) oaddr = shortp[shortp[0] - 1]; if ((bp->flags & BUF_MOD) && __put_page(hashp, bp->page, @@ -238,7 +246,7 @@ newbuf(hashp, addr, prev_bp) (oaddr != xbp->addr)) break; - shortp = (u_short *)xbp->page; + shortp = (u_int16_t *)xbp->page; if (shortp[0]) /* set before __put_page */ oaddr = shortp[shortp[0] - 1]; |