Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/xlint/lint1 only fill memory with junk if BLKDEBUG



details:   https://anonhg.NetBSD.org/src/rev/81b7c476a356
branches:  trunk
changeset: 328783:81b7c476a356
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Apr 18 00:21:14 2014 +0000

description:
only fill memory with junk if BLKDEBUG

diffstat:

 usr.bin/xlint/lint1/lint1.h |  10 ++++++++--
 usr.bin/xlint/lint1/mem1.c  |  13 +++++++++----
 2 files changed, 17 insertions(+), 6 deletions(-)

diffs (79 lines):

diff -r 2a6cfd5d5b86 -r 81b7c476a356 usr.bin/xlint/lint1/lint1.h
--- a/usr.bin/xlint/lint1/lint1.h       Fri Apr 18 00:20:37 2014 +0000
+++ b/usr.bin/xlint/lint1/lint1.h       Fri Apr 18 00:21:14 2014 +0000
@@ -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 @@
        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 @@
 
 #define LERROR(fmt, args...)   lerror(__FILE__, __LINE__, fmt, ##args)
 
+#ifdef BLKDEBUG
+#define ZERO   0xa5
+#else
+#define        ZERO    0
+#endif
+
 extern err_set msgset;
diff -r 2a6cfd5d5b86 -r 81b7c476a356 usr.bin/xlint/lint1/mem1.c
--- a/usr.bin/xlint/lint1/mem1.c        Fri Apr 18 00:20:37 2014 +0000
+++ b/usr.bin/xlint/lint1/mem1.c        Fri Apr 18 00:21:14 2014 +0000
@@ -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 <sys/cdefs.h>
 #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 <sys/types.h>
@@ -200,9 +200,11 @@
                                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 @@
        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 @@
                *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);
        }
 }
 



Home | Main Index | Thread Index | Old Index