From 59bbfbb11d81ce54ffeb942cf48d27145db8627f Mon Sep 17 00:00:00 2001 From: christos Date: Fri, 18 Apr 2014 00:21:14 +0000 Subject: [PATCH] only fill memory with junk if BLKDEBUG --- usr.bin/xlint/lint1/lint1.h | 10 ++++++++-- usr.bin/xlint/lint1/mem1.c | 13 +++++++++---- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/usr.bin/xlint/lint1/lint1.h b/usr.bin/xlint/lint1/lint1.h index 2ec7be377043..45f9f7d91222 100644 --- a/usr.bin/xlint/lint1/lint1.h +++ b/usr.bin/xlint/lint1/lint1.h @@ -1,4 +1,4 @@ -/* $NetBSD: lint1.h,v 1.27 2013/04/19 17:43:05 christos Exp $ */ +/* $NetBSD: lint1.h,v 1.28 2014/04/18 00:21:14 christos Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -226,7 +226,7 @@ typedef struct sym { pos_t s_spos; /* position of first initialisation */ pos_t s_upos; /* position of first use */ symt_t s_kind; /* type of symbol */ - u_int s_keyw : 1; /* keyword */ + void *s_keyw; /* keyword */ u_int s_field : 1; /* bit-field */ u_int s_set : 1; /* variable set, label defined */ u_int s_used : 1; /* variable/label used */ @@ -436,4 +436,10 @@ typedef struct err_set { #define LERROR(fmt, args...) lerror(__FILE__, __LINE__, fmt, ##args) +#ifdef BLKDEBUG +#define ZERO 0xa5 +#else +#define ZERO 0 +#endif + extern err_set msgset; diff --git a/usr.bin/xlint/lint1/mem1.c b/usr.bin/xlint/lint1/mem1.c index 4340e8953da8..559ba804890d 100644 --- a/usr.bin/xlint/lint1/mem1.c +++ b/usr.bin/xlint/lint1/mem1.c @@ -1,4 +1,4 @@ -/* $NetBSD: mem1.c,v 1.16 2014/04/17 16:30:05 christos Exp $ */ +/* $NetBSD: mem1.c,v 1.17 2014/04/18 00:21:14 christos Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: mem1.c,v 1.16 2014/04/17 16:30:05 christos Exp $"); +__RCSID("$NetBSD: mem1.c,v 1.17 2014/04/18 00:21:14 christos Exp $"); #endif #include @@ -200,9 +200,11 @@ xgetblk(mbl_t **mbp, size_t s) mblklen = s; } mb = xnewblk(); +#ifndef BLKDEBUG + (void)memset(mb->blk, 0, mb->size); +#endif if (t) mblklen = t; - (void)memset(mb->blk, 0, mb->size); } else { frmblks = mb->nxt; } @@ -214,6 +216,9 @@ xgetblk(mbl_t **mbp, size_t s) p = mb->ffree; mb->ffree = (char *)mb->ffree + s; mb->nfree -= s; +#ifdef BLKDEBUG + (void)memset(p, 0, s); +#endif return (p); } @@ -230,7 +235,7 @@ xfreeblk(mbl_t **fmbp) *fmbp = mb->nxt; mb->nxt = frmblks; frmblks = mb; - (void)memset(mb->blk, 0xa5, mb->size - mb->nfree); + (void)memset(mb->blk, ZERO, mb->size - mb->nfree); } }