Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make make(1): make Lst_Prev stricter regarding null ...



details:   https://anonhg.NetBSD.org/src/rev/ee8ab95e40af
branches:  trunk
changeset: 937647:ee8ab95e40af
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Aug 22 22:00:50 2020 +0000

description:
make(1): make Lst_Prev stricter regarding null pointers

diffstat:

 usr.bin/make/lst.c  |  15 ++++++---------
 usr.bin/make/lst.h  |   4 ++--
 usr.bin/make/suff.c |   8 ++++----
 3 files changed, 12 insertions(+), 15 deletions(-)

diffs (93 lines):

diff -r 109a68f83669 -r ee8ab95e40af usr.bin/make/lst.c
--- a/usr.bin/make/lst.c        Sat Aug 22 21:58:27 2020 +0000
+++ b/usr.bin/make/lst.c        Sat Aug 22 22:00:50 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.c,v 1.32 2020/08/22 21:42:38 rillig Exp $ */
+/* $NetBSD: lst.c,v 1.33 2020/08/22 22:00:50 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -37,11 +37,11 @@
 #include "make.h"
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: lst.c,v 1.32 2020/08/22 21:42:38 rillig Exp $";
+static char rcsid[] = "$NetBSD: lst.c,v 1.33 2020/08/22 22:00:50 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: lst.c,v 1.32 2020/08/22 21:42:38 rillig Exp $");
+__RCSID("$NetBSD: lst.c,v 1.33 2020/08/22 22:00:50 rillig Exp $");
 #endif /* not lint */
 #endif
 
@@ -456,13 +456,10 @@
 
 /* Return the predecessor to the given node on its list, or NULL. */
 LstNode
-Lst_Prev(LstNode node)
+Lst_PrevS(LstNode node)
 {
-    if (node == NULL) {
-       return NULL;
-    } else {
-       return node->prev;
-    }
+    assert(LstNodeIsValid(node));
+    return node->prev;
 }
 
 /* Return the datum stored in the given node. */
diff -r 109a68f83669 -r ee8ab95e40af usr.bin/make/lst.h
--- a/usr.bin/make/lst.h        Sat Aug 22 21:58:27 2020 +0000
+++ b/usr.bin/make/lst.h        Sat Aug 22 22:00:50 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lst.h,v 1.35 2020/08/22 15:43:32 rillig Exp $  */
+/*     $NetBSD: lst.h,v 1.36 2020/08/22 22:00:50 rillig Exp $  */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -139,7 +139,7 @@
 /* Return successor to given element */
 LstNode                Lst_Succ(LstNode);
 /* Return predecessor to given element */
-LstNode                Lst_Prev(LstNode);
+LstNode                Lst_PrevS(LstNode);
 /* Get datum from LstNode */
 void           *Lst_DatumS(LstNode);
 
diff -r 109a68f83669 -r ee8ab95e40af usr.bin/make/suff.c
--- a/usr.bin/make/suff.c       Sat Aug 22 21:58:27 2020 +0000
+++ b/usr.bin/make/suff.c       Sat Aug 22 22:00:50 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: suff.c,v 1.109 2020/08/22 21:42:38 rillig Exp $        */
+/*     $NetBSD: suff.c,v 1.110 2020/08/22 22:00:50 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: suff.c,v 1.109 2020/08/22 21:42:38 rillig Exp $";
+static char rcsid[] = "$NetBSD: suff.c,v 1.110 2020/08/22 22:00:50 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)suff.c     8.4 (Berkeley) 3/21/94";
 #else
-__RCSID("$NetBSD: suff.c,v 1.109 2020/08/22 21:42:38 rillig Exp $");
+__RCSID("$NetBSD: suff.c,v 1.110 2020/08/22 22:00:50 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1649,7 +1649,7 @@
            Lst_AppendS(gn->parents, pgn);
            pgn->unmade++;
            /* Expand wildcards on new node */
-           SuffExpandWildcards(Lst_Prev(cln), pgn);
+           SuffExpandWildcards(Lst_PrevS(cln), pgn);
        }
        Lst_Destroy(members, NULL);
 



Home | Main Index | Thread Index | Old Index