Module Name: src Committed By: rillig Date: Sat Aug 22 22:00:50 UTC 2020
Modified Files: src/usr.bin/make: lst.c lst.h suff.c Log Message: make(1): make Lst_Prev stricter regarding null pointers To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/usr.bin/make/lst.c cvs rdiff -u -r1.35 -r1.36 src/usr.bin/make/lst.h cvs rdiff -u -r1.109 -r1.110 src/usr.bin/make/suff.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/make/lst.c diff -u src/usr.bin/make/lst.c:1.32 src/usr.bin/make/lst.c:1.33 --- src/usr.bin/make/lst.c:1.32 Sat Aug 22 21:42:38 2020 +++ src/usr.bin/make/lst.c Sat Aug 22 22:00:50 2020 @@ -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 @@ Lst_Succ(LstNode node) /* 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. */ Index: src/usr.bin/make/lst.h diff -u src/usr.bin/make/lst.h:1.35 src/usr.bin/make/lst.h:1.36 --- src/usr.bin/make/lst.h:1.35 Sat Aug 22 15:43:32 2020 +++ src/usr.bin/make/lst.h Sat Aug 22 22:00:50 2020 @@ -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 @@ LstNode Lst_Last(Lst); /* 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); Index: src/usr.bin/make/suff.c diff -u src/usr.bin/make/suff.c:1.109 src/usr.bin/make/suff.c:1.110 --- src/usr.bin/make/suff.c:1.109 Sat Aug 22 21:42:38 2020 +++ src/usr.bin/make/suff.c Sat Aug 22 22:00:50 2020 @@ -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 @@ SuffExpandChildren(LstNode cln, GNode *p 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);