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 lint: don't try to trick mathematics by ...



details:   https://anonhg.NetBSD.org/src/rev/cd1e4de513e6
branches:  trunk
changeset: 1029185:cd1e4de513e6
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Dec 25 13:51:42 2021 +0000

description:
lint: don't try to trick mathematics by defining ZERO to a nonzero value

No binary change.

diffstat:

 usr.bin/xlint/lint1/lex.c   |  6 +++---
 usr.bin/xlint/lint1/lint1.h |  6 +++---
 usr.bin/xlint/lint1/mem1.c  |  7 ++++---
 3 files changed, 10 insertions(+), 9 deletions(-)

diffs (76 lines):

diff -r 50a2fd762e3a -r cd1e4de513e6 usr.bin/xlint/lint1/lex.c
--- a/usr.bin/xlint/lint1/lex.c Sat Dec 25 13:51:31 2021 +0000
+++ b/usr.bin/xlint/lint1/lex.c Sat Dec 25 13:51:42 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.95 2021/12/22 15:47:42 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.96 2021/12/25 13:51:42 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: lex.c,v 1.95 2021/12/22 15:47:42 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.96 2021/12/25 13:51:42 rillig Exp $");
 #endif
 
 #include <ctype.h>
@@ -369,7 +369,7 @@
 freesb(sbuf_t *sb)
 {
 
-       (void)memset(sb, ZERO, sizeof(*sb));
+       (void)memset(sb, INVALID_MEM_BYTE, sizeof(*sb));
        sb->sb_next = sbuf_free_list;
        sbuf_free_list = sb;
 }
diff -r 50a2fd762e3a -r cd1e4de513e6 usr.bin/xlint/lint1/lint1.h
--- a/usr.bin/xlint/lint1/lint1.h       Sat Dec 25 13:51:31 2021 +0000
+++ b/usr.bin/xlint/lint1/lint1.h       Sat Dec 25 13:51:42 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.133 2021/12/22 15:20:08 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.134 2021/12/25 13:51:42 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -486,9 +486,9 @@
        } while (false)
 
 #ifdef BLKDEBUG
-#define ZERO   0xa5
+#define INVALID_MEM_BYTE       0xa5
 #else
-#define        ZERO    0
+#define        INVALID_MEM_BYTE        0
 #endif
 
 extern err_set msgset;
diff -r 50a2fd762e3a -r cd1e4de513e6 usr.bin/xlint/lint1/mem1.c
--- a/usr.bin/xlint/lint1/mem1.c        Sat Dec 25 13:51:31 2021 +0000
+++ b/usr.bin/xlint/lint1/mem1.c        Sat Dec 25 13:51:42 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mem1.c,v 1.56 2021/12/21 15:24:28 rillig Exp $ */
+/*     $NetBSD: mem1.c,v 1.57 2021/12/25 13:51:42 rillig 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.56 2021/12/21 15:24:28 rillig Exp $");
+__RCSID("$NetBSD: mem1.c,v 1.57 2021/12/25 13:51:42 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -276,7 +276,8 @@
                *fmbp = mb->next;
                mb->next = frmblks;
                frmblks = mb;
-               (void)memset(mb->start, ZERO, mb->size - mb->nfree);
+               (void)memset(mb->start, INVALID_MEM_BYTE,
+                   mb->size - mb->nfree);
        }
 }
 



Home | Main Index | Thread Index | Old Index