fix debugging memsets.

This commit is contained in:
christos 2006-01-24 17:37:05 +00:00
parent a3ae551d7e
commit 096020da19
1 changed files with 7 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: mpool.c,v 1.14 2003/08/07 16:42:44 agc Exp $ */ /* $NetBSD: mpool.c,v 1.15 2006/01/24 17:37:05 christos Exp $ */
/*- /*-
* Copyright (c) 1990, 1993, 1994 * Copyright (c) 1990, 1993, 1994
@ -34,7 +34,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)mpool.c 8.5 (Berkeley) 7/26/94"; static char sccsid[] = "@(#)mpool.c 8.5 (Berkeley) 7/26/94";
#else #else
__RCSID("$NetBSD: mpool.c,v 1.14 2003/08/07 16:42:44 agc Exp $"); __RCSID("$NetBSD: mpool.c,v 1.15 2006/01/24 17:37:05 christos Exp $");
#endif #endif
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
@ -350,9 +350,10 @@ mpool_bkt(mp)
CIRCLEQ_REMOVE(head, bp, hq); CIRCLEQ_REMOVE(head, bp, hq);
CIRCLEQ_REMOVE(&mp->lqh, bp, q); CIRCLEQ_REMOVE(&mp->lqh, bp, q);
#ifdef DEBUG #ifdef DEBUG
{ void *spage; {
spage = bp->page; void *spage = bp->page;
memset(bp, 0xff, sizeof(BKT) + mp->pagesize); (void)memset(bp, 0xff,
(size_t)(sizeof(BKT) + mp->pagesize));
bp->page = spage; bp->page = spage;
} }
#endif #endif
@ -365,7 +366,7 @@ new: if ((bp = (BKT *)malloc((size_t)(sizeof(BKT) + mp->pagesize))) == NULL)
++mp->pagealloc; ++mp->pagealloc;
#endif #endif
#if defined(DEBUG) || defined(PURIFY) #if defined(DEBUG) || defined(PURIFY)
memset(bp, 0xff, sizeof(BKT) + mp->pagesize); (void)memset(bp, 0xff, (size_t)(sizeof(BKT) + mp->pagesize));
#endif #endif
bp->page = (char *)(void *)bp + sizeof(BKT); bp->page = (char *)(void *)bp + sizeof(BKT);
++mp->curcache; ++mp->curcache;