Module Name:    src
Committed By:   rillig
Date:           Sat Aug 22 15:17:09 UTC 2020

Modified Files:
        src/usr.bin/make: arch.c dir.c lst.c lst.h main.c make.c meta.c parse.c
            suff.c targ.c

Log Message:
make(1): replace Lst_Datum with non-null guaranteeing Lst_DatumS


To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.89 src/usr.bin/make/arch.c
cvs rdiff -u -r1.102 -r1.103 src/usr.bin/make/dir.c
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/make/lst.c
cvs rdiff -u -r1.33 -r1.34 src/usr.bin/make/lst.h
cvs rdiff -u -r1.307 -r1.308 src/usr.bin/make/main.c
cvs rdiff -u -r1.116 -r1.117 src/usr.bin/make/make.c
cvs rdiff -u -r1.95 -r1.96 src/usr.bin/make/meta.c
cvs rdiff -u -r1.256 -r1.257 src/usr.bin/make/parse.c
cvs rdiff -u -r1.105 -r1.106 src/usr.bin/make/suff.c
cvs rdiff -u -r1.69 -r1.70 src/usr.bin/make/targ.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/arch.c
diff -u src/usr.bin/make/arch.c:1.88 src/usr.bin/make/arch.c:1.89
--- src/usr.bin/make/arch.c:1.88	Sat Aug 22 14:39:12 2020
+++ src/usr.bin/make/arch.c	Sat Aug 22 15:17:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: arch.c,v 1.88 2020/08/22 14:39:12 rillig Exp $	*/
+/*	$NetBSD: arch.c,v 1.89 2020/08/22 15:17:09 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: arch.c,v 1.88 2020/08/22 14:39:12 rillig Exp $";
+static char rcsid[] = "$NetBSD: arch.c,v 1.89 2020/08/22 15:17:09 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)arch.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: arch.c,v 1.88 2020/08/22 14:39:12 rillig Exp $");
+__RCSID("$NetBSD: arch.c,v 1.89 2020/08/22 15:17:09 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -544,7 +544,7 @@ ArchStatMember(const char *archive, cons
 
     ln = Lst_Find(archives, archive, ArchFindArchive);
     if (ln != NULL) {
-	ar = (Arch *)Lst_Datum(ln);
+	ar = Lst_DatumS(ln);
 
 	he = Hash_FindEntry(&ar->members, member);
 
@@ -1130,7 +1130,7 @@ Arch_MemMTime(GNode *gn)
 	return 0;
     }
     while ((ln = Lst_NextS(gn->parents)) != NULL) {
-	pgn = (GNode *)Lst_Datum(ln);
+	pgn = Lst_DatumS(ln);
 
 	if (pgn->type & OP_ARCHV) {
 	    /*

Index: src/usr.bin/make/dir.c
diff -u src/usr.bin/make/dir.c:1.102 src/usr.bin/make/dir.c:1.103
--- src/usr.bin/make/dir.c:1.102	Sat Aug 22 14:39:12 2020
+++ src/usr.bin/make/dir.c	Sat Aug 22 15:17:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dir.c,v 1.102 2020/08/22 14:39:12 rillig Exp $	*/
+/*	$NetBSD: dir.c,v 1.103 2020/08/22 15:17:09 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: dir.c,v 1.102 2020/08/22 14:39:12 rillig Exp $";
+static char rcsid[] = "$NetBSD: dir.c,v 1.103 2020/08/22 15:17:09 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)dir.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: dir.c,v 1.102 2020/08/22 14:39:12 rillig Exp $");
+__RCSID("$NetBSD: dir.c,v 1.103 2020/08/22 15:17:09 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -484,7 +484,7 @@ Dir_SetPATH(void)
 
     if (Lst_Open(dirSearchPath) == SUCCESS) {
 	if ((ln = Lst_First(dirSearchPath)) != NULL) {
-	    p = (Path *)Lst_Datum(ln);
+	    p = Lst_DatumS(ln);
 	    if (p == dotLast) {
 		hasLastDot = TRUE;
 		Var_Append(".PATH", dotLast->name, VAR_GLOBAL);
@@ -499,7 +499,7 @@ Dir_SetPATH(void)
 	}
 
 	while ((ln = Lst_NextS(dirSearchPath)) != NULL) {
-	    p = (Path *)Lst_Datum(ln);
+	    p = Lst_DatumS(ln);
 	    if (p == dotLast)
 		continue;
 	    if (p == dot && hasLastDot)
@@ -795,11 +795,10 @@ static void
 DirExpandInt(const char *word, Lst path, Lst expansions)
 {
     LstNode ln;			/* Current node */
-    Path *p;			/* Directory in the node */
 
     if (Lst_Open(path) == SUCCESS) {
 	while ((ln = Lst_NextS(path)) != NULL) {
-	    p = (Path *)Lst_Datum(ln);
+	    Path *p = Lst_DatumS(ln);
 	    DirMatchFiles(word, p, expansions);
 	}
 	Lst_CloseS(path);
@@ -1137,7 +1136,7 @@ Dir_FindFile(const char *name, Lst path)
     }
 
     if ((ln = Lst_First(path)) != NULL) {
-	p = (Path *)Lst_Datum(ln);
+	p = Lst_DatumS(ln);
 	if (p == dotLast) {
 	    hasLastDot = TRUE;
 	    DIR_DEBUG0("[dot last]...");
@@ -1171,7 +1170,7 @@ Dir_FindFile(const char *name, Lst path)
 	}
 
 	while ((ln = Lst_NextS(path)) != NULL) {
-	    p = (Path *)Lst_Datum(ln);
+	    p = Lst_DatumS(ln);
 	    if (p == dotLast)
 		continue;
 	    if ((file = DirLookup(p, name, cp, hasSlash)) != NULL) {
@@ -1229,7 +1228,7 @@ Dir_FindFile(const char *name, Lst path)
 
 	Lst_OpenS(path);
 	while ((ln = Lst_NextS(path)) != NULL) {
-	    p = (Path *)Lst_Datum(ln);
+	    p = Lst_DatumS(ln);
 	    if (p == dotLast)
 		continue;
 	    if (p == dot) {
@@ -1287,7 +1286,7 @@ Dir_FindFile(const char *name, Lst path)
 
 	Lst_OpenS(path);
 	while ((ln = Lst_NextS(path)) != NULL) {
-	    p = (Path *)Lst_Datum(ln);
+	    p = Lst_DatumS(ln);
 	    if (p == dotLast)
 		continue;
 	    if ((file = DirLookupAbs(p, name, cp)) != NULL) {
@@ -1342,7 +1341,7 @@ Dir_FindFile(const char *name, Lst path)
     if (ln == NULL) {
 	return NULL;
     } else {
-	p = (Path *)Lst_Datum(ln);
+	p = Lst_DatumS(ln);
     }
 
     if (Hash_FindEntry(&p->files, cp) != NULL) {
@@ -1564,7 +1563,7 @@ Dir_AddDir(Lst path, const char *name)
     if (strcmp(name, ".DOTLAST") == 0) {
 	ln = Lst_Find(path, name, DirFindName);
 	if (ln != NULL)
-	    return (Path *)Lst_Datum(ln);
+	    return Lst_DatumS(ln);
 	else {
 	    dotLast->refCount += 1;
 	    (void)Lst_AtFront(path, dotLast);
@@ -1574,7 +1573,7 @@ Dir_AddDir(Lst path, const char *name)
     if (path)
 	ln = Lst_Find(openDirectories, name, DirFindName);
     if (ln != NULL) {
-	p = (Path *)Lst_Datum(ln);
+	p = Lst_DatumS(ln);
 	if (path && Lst_Member(path, p) == NULL) {
 	    p->refCount += 1;
 	    Lst_AppendS(path, p);
@@ -1665,7 +1664,7 @@ Dir_MakeFlags(const char *flag, Lst path
 
     if (Lst_Open(path) == SUCCESS) {
 	while ((ln = Lst_NextS(path)) != NULL) {
-	    Path *p = (Path *)Lst_Datum(ln);
+	    Path *p = Lst_DatumS(ln);
 	    Buf_AddStr(&buf, " ");
 	    Buf_AddStr(&buf, flag);
 	    Buf_AddStr(&buf, p->name);
@@ -1764,7 +1763,7 @@ Dir_Concat(Lst path1, Lst path2)
     Path *p;
 
     for (ln = Lst_First(path2); ln != NULL; ln = Lst_Succ(ln)) {
-	p = (Path *)Lst_Datum(ln);
+	p = Lst_DatumS(ln);
 	if (Lst_Member(path1, p) == NULL) {
 	    p->refCount += 1;
 	    Lst_AppendS(path1, p);
@@ -1788,7 +1787,7 @@ Dir_PrintDirectories(void)
     fprintf(debug_file, "# %-20s referenced\thits\n", "directory");
     if (Lst_Open(openDirectories) == SUCCESS) {
 	while ((ln = Lst_NextS(openDirectories)) != NULL) {
-	    p = (Path *)Lst_Datum(ln);
+	    p = Lst_DatumS(ln);
 	    fprintf(debug_file, "# %-20s %10d\t%4d\n", p->name, p->refCount,
 		    p->hits);
 	}

Index: src/usr.bin/make/lst.c
diff -u src/usr.bin/make/lst.c:1.27 src/usr.bin/make/lst.c:1.28
--- src/usr.bin/make/lst.c:1.27	Sat Aug 22 14:56:45 2020
+++ src/usr.bin/make/lst.c	Sat Aug 22 15:17:09 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.c,v 1.27 2020/08/22 14:56:45 rillig Exp $ */
+/* $NetBSD: lst.c,v 1.28 2020/08/22 15:17:09 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.27 2020/08/22 14:56:45 rillig Exp $";
+static char rcsid[] = "$NetBSD: lst.c,v 1.28 2020/08/22 15:17:09 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: lst.c,v 1.27 2020/08/22 14:56:45 rillig Exp $");
+__RCSID("$NetBSD: lst.c,v 1.28 2020/08/22 15:17:09 rillig Exp $");
 #endif /* not lint */
 #endif
 
@@ -465,15 +465,12 @@ Lst_Prev(LstNode node)
     }
 }
 
-/* Return the datum stored in the given node, or NULL if the node is invalid. */
+/* Return the datum stored in the given node. */
 void *
-Lst_Datum(LstNode node)
+Lst_DatumS(LstNode node)
 {
-    if (node != NULL) {
-	return node->datum;
-    } else {
-	return NULL;
-    }
+    assert(LstNodeIsValid(node));
+    return node->datum;
 }
 
 

Index: src/usr.bin/make/lst.h
diff -u src/usr.bin/make/lst.h:1.33 src/usr.bin/make/lst.h:1.34
--- src/usr.bin/make/lst.h:1.33	Sat Aug 22 14:56:45 2020
+++ src/usr.bin/make/lst.h	Sat Aug 22 15:17:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: lst.h,v 1.33 2020/08/22 14:56:45 rillig Exp $	*/
+/*	$NetBSD: lst.h,v 1.34 2020/08/22 15:17:09 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -141,7 +141,7 @@ LstNode		Lst_Succ(LstNode);
 /* Return predecessor to given element */
 LstNode		Lst_Prev(LstNode);
 /* Get datum from LstNode */
-void		*Lst_Datum(LstNode);
+void		*Lst_DatumS(LstNode);
 
 /*
  * Functions for entire lists

Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.307 src/usr.bin/make/main.c:1.308
--- src/usr.bin/make/main.c:1.307	Sat Aug 22 11:35:00 2020
+++ src/usr.bin/make/main.c	Sat Aug 22 15:17:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.307 2020/08/22 11:35:00 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.308 2020/08/22 15:17:09 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.307 2020/08/22 11:35:00 rillig Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.308 2020/08/22 15:17:09 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
@@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)main.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: main.c,v 1.307 2020/08/22 11:35:00 rillig Exp $");
+__RCSID("$NetBSD: main.c,v 1.308 2020/08/22 15:17:09 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -873,7 +873,7 @@ doPrintVars(void)
 
 	for (ln = Lst_First(variables); ln != NULL;
 	    ln = Lst_Succ(ln)) {
-		char *var = (char *)Lst_Datum(ln);
+		char *var = Lst_DatumS(ln);
 		const char *value;
 		char *p1;
 
@@ -1281,10 +1281,8 @@ main(int argc, char **argv)
 	if (!Lst_IsEmpty(create)) {
 		LstNode ln;
 
-		for (ln = Lst_First(create); ln != NULL;
-		    ln = Lst_Succ(ln)) {
-			char *name = (char *)Lst_Datum(ln);
-
+		for (ln = Lst_First(create); ln != NULL; ln = Lst_Succ(ln)) {
+			char *name = Lst_DatumS(ln);
 			Var_Append(".TARGETS", name, VAR_GLOBAL);
 		}
 	} else
@@ -1338,7 +1336,7 @@ main(int argc, char **argv)
 		ln = Lst_Find(sysMkPath, NULL, ReadMakefile);
 		if (ln == NULL)
 			Fatal("%s: cannot open %s.", progname,
-			    (char *)Lst_Datum(ln));
+			    (char *)Lst_DatumS(ln));
 	}
 
 	if (!Lst_IsEmpty(makefiles)) {
@@ -1347,7 +1345,7 @@ main(int argc, char **argv)
 		ln = Lst_Find(makefiles, NULL, ReadAllMakefiles);
 		if (ln != NULL)
 			Fatal("%s: cannot open %s.", progname,
-			    (char *)Lst_Datum(ln));
+			    (char *)Lst_DatumS(ln));
 	} else {
 	    p1 = Var_Subst("${" MAKEFILE_PREFERENCE "}",
 		VAR_CMD, VARE_WANTRES);

Index: src/usr.bin/make/make.c
diff -u src/usr.bin/make/make.c:1.116 src/usr.bin/make/make.c:1.117
--- src/usr.bin/make/make.c:1.116	Sat Aug 22 14:54:48 2020
+++ src/usr.bin/make/make.c	Sat Aug 22 15:17:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.c,v 1.116 2020/08/22 14:54:48 rillig Exp $	*/
+/*	$NetBSD: make.c,v 1.117 2020/08/22 15:17:09 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: make.c,v 1.116 2020/08/22 14:54:48 rillig Exp $";
+static char rcsid[] = "$NetBSD: make.c,v 1.117 2020/08/22 15:17:09 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)make.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: make.c,v 1.116 2020/08/22 14:54:48 rillig Exp $");
+__RCSID("$NetBSD: make.c,v 1.117 2020/08/22 15:17:09 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -449,7 +449,7 @@ Make_HandleUse(GNode *cgn, GNode *pgn)
 
     if (Lst_Open(cgn->children) == SUCCESS) {
 	while ((ln = Lst_NextS(cgn->children)) != NULL) {
-	    GNode *tgn, *gn = (GNode *)Lst_Datum(ln);
+	    GNode *tgn, *gn = Lst_DatumS(ln);
 
 	    /*
 	     * Expand variables in the .USE node's name
@@ -704,7 +704,7 @@ Make_Update(GNode *cgn)
     /* Now mark all the parents as having one less unmade child */
     if (Lst_Open(parents) == SUCCESS) {
 	while ((ln = Lst_NextS(parents)) != NULL) {
-	    pgn = (GNode *)Lst_Datum(ln);
+	    pgn = Lst_DatumS(ln);
 	    if (DEBUG(MAKE))
 		fprintf(debug_file, "inspect parent %s%s: flags %x, "
 			    "type %x, made %d, unmade %d ",
@@ -807,7 +807,7 @@ Make_Update(GNode *cgn)
 	const char *cpref = Var_Value(PREFIX, cgn, &p1);
 
 	while ((ln = Lst_NextS(cgn->iParents)) != NULL) {
-	    pgn = (GNode *)Lst_Datum(ln);
+	    pgn = Lst_DatumS(ln);
 	    if (pgn->flags & REMAKE) {
 		Var_Set(IMPSRC, cname, pgn);
 		if (cpref != NULL)
@@ -1426,7 +1426,7 @@ Make_ProcessWait(Lst targs)
 	owln = Lst_First(pgn->children);
 	Lst_OpenS(pgn->children);
 	for (; (ln = Lst_NextS(pgn->children)) != NULL; ) {
-	    cgn = Lst_Datum(ln);
+	    cgn = Lst_DatumS(ln);
 	    if (cgn->type & OP_WAIT) {
 		/* Make the .WAIT node depend on the previous children */
 		Lst_ForEachFrom(pgn->children, owln, add_wait_dep, cgn);

Index: src/usr.bin/make/meta.c
diff -u src/usr.bin/make/meta.c:1.95 src/usr.bin/make/meta.c:1.96
--- src/usr.bin/make/meta.c:1.95	Sat Aug 22 13:28:20 2020
+++ src/usr.bin/make/meta.c	Sat Aug 22 15:17:09 2020
@@ -1,4 +1,4 @@
-/*      $NetBSD: meta.c,v 1.95 2020/08/22 13:28:20 rillig Exp $ */
+/*      $NetBSD: meta.c,v 1.96 2020/08/22 15:17:09 rillig Exp $ */
 
 /*
  * Implement 'meta' mode.
@@ -1340,7 +1340,7 @@ meta_oodate(GNode *gn, Boolean oodate)
 			    do {
 				nln = Lst_FindFrom(missingFiles, Lst_Succ(ln),
 						   p, path_match);
-				tp = Lst_Datum(ln);
+				tp = Lst_DatumS(ln);
 				Lst_RemoveS(missingFiles, ln);
 				free(tp);
 			    } while ((ln = nln) != NULL);
@@ -1519,7 +1519,7 @@ meta_oodate(GNode *gn, Boolean oodate)
 			fprintf(debug_file, "%s: %d: there were more build commands in the meta data file than there are now...\n", fname, lineno);
 		    oodate = TRUE;
 		} else {
-		    char *cmd = (char *)Lst_Datum(ln);
+		    char *cmd = Lst_DatumS(ln);
 		    Boolean hasOODATE = FALSE;
 
 		    if (strstr(cmd, "$?"))
@@ -1596,7 +1596,7 @@ meta_oodate(GNode *gn, Boolean oodate)
 	if (!Lst_IsEmpty(missingFiles)) {
 	    if (DEBUG(META))
 		fprintf(debug_file, "%s: missing files: %s...\n",
-			fname, (char *)Lst_Datum(Lst_First(missingFiles)));
+			fname, (char *)Lst_DatumS(Lst_First(missingFiles)));
 	    oodate = TRUE;
 	}
 	if (!oodate && !have_filemon && filemonMissing) {

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.256 src/usr.bin/make/parse.c:1.257
--- src/usr.bin/make/parse.c:1.256	Sat Aug 22 14:39:12 2020
+++ src/usr.bin/make/parse.c	Sat Aug 22 15:17:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.256 2020/08/22 14:39:12 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.257 2020/08/22 15:17:09 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: parse.c,v 1.256 2020/08/22 14:39:12 rillig Exp $";
+static char rcsid[] = "$NetBSD: parse.c,v 1.257 2020/08/22 15:17:09 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)parse.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: parse.c,v 1.256 2020/08/22 14:39:12 rillig Exp $");
+__RCSID("$NetBSD: parse.c,v 1.257 2020/08/22 15:17:09 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -854,8 +854,8 @@ ParseLinkSrc(void *pgnp, void *cgnp)
     GNode          *pgn = (GNode *)pgnp;
     GNode          *cgn = (GNode *)cgnp;
 
-    if ((pgn->type & OP_DOUBLEDEP) && !Lst_IsEmpty (pgn->cohorts))
-	pgn = (GNode *)Lst_Datum(Lst_Last(pgn->cohorts));
+    if ((pgn->type & OP_DOUBLEDEP) && !Lst_IsEmpty(pgn->cohorts))
+	pgn = Lst_DatumS(Lst_Last(pgn->cohorts));
     Lst_AppendS(pgn->children, cgn);
     if (specType == Not)
 	Lst_AppendS(cgn->parents, pgn);
@@ -2083,8 +2083,8 @@ ParseAddCmd(void *gnp, void *cmd)
     GNode *gn = (GNode *)gnp;
 
     /* Add to last (ie current) cohort for :: targets */
-    if ((gn->type & OP_DOUBLEDEP) && !Lst_IsEmpty (gn->cohorts))
-	gn = (GNode *)Lst_Datum(Lst_Last(gn->cohorts));
+    if ((gn->type & OP_DOUBLEDEP) && !Lst_IsEmpty(gn->cohorts))
+	gn = Lst_DatumS(Lst_Last(gn->cohorts));
 
     /* if target already supplied, ignore commands */
     if (!(gn->type & OP_HAS_COMMANDS)) {

Index: src/usr.bin/make/suff.c
diff -u src/usr.bin/make/suff.c:1.105 src/usr.bin/make/suff.c:1.106
--- src/usr.bin/make/suff.c:1.105	Sat Aug 22 14:54:48 2020
+++ src/usr.bin/make/suff.c	Sat Aug 22 15:17:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.105 2020/08/22 14:54:48 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.106 2020/08/22 15:17:09 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: suff.c,v 1.105 2020/08/22 14:54:48 rillig Exp $";
+static char rcsid[] = "$NetBSD: suff.c,v 1.106 2020/08/22 15:17:09 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.105 2020/08/22 14:54:48 rillig Exp $");
+__RCSID("$NetBSD: suff.c,v 1.106 2020/08/22 15:17:09 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -501,7 +501,7 @@ SuffInsert(Lst l, Suff *s)
 
     Lst_OpenS(l);
     while ((ln = Lst_NextS(l)) != NULL) {
-	s2 = (Suff *)Lst_Datum(ln);
+	s2 = Lst_DatumS(ln);
 	if (s2->sNum >= s->sNum) {
 	    break;
 	}
@@ -637,7 +637,7 @@ SuffParseTransform(char *str, Suff **src
 	    }
 	    return FALSE;
 	}
-	src = (Suff *)Lst_Datum(srcLn);
+	src = Lst_DatumS(srcLn);
 	str2 = str + src->nameLen;
 	if (*str2 == '\0') {
 	    single = src;
@@ -646,7 +646,7 @@ SuffParseTransform(char *str, Suff **src
 	    targLn = Lst_Find(sufflist, str2, SuffSuffHasNameP);
 	    if (targLn != NULL) {
 		*srcPtr = src;
-		*targPtr = (Suff *)Lst_Datum(targLn);
+		*targPtr = Lst_DatumS(targLn);
 		return TRUE;
 	    }
 	}
@@ -718,7 +718,7 @@ Suff_AddTransform(char *line)
 	 * free the commands themselves, because a given command can be
 	 * attached to several different transformations.
 	 */
-	gn = (GNode *)Lst_Datum(ln);
+	gn = Lst_DatumS(ln);
 	Lst_Destroy(gn->commands, NULL);
 	Lst_Destroy(gn->children, NULL);
 	gn->commands = Lst_Init();
@@ -768,8 +768,8 @@ Suff_EndTransform(void *gnp, void *dummy
 {
     GNode *gn = (GNode *)gnp;
 
-    if ((gn->type & OP_DOUBLEDEP) && !Lst_IsEmpty (gn->cohorts))
-	gn = (GNode *)Lst_Datum(Lst_Last(gn->cohorts));
+    if ((gn->type & OP_DOUBLEDEP) && !Lst_IsEmpty(gn->cohorts))
+	gn = Lst_DatumS(Lst_Last(gn->cohorts));
     if ((gn->type & OP_TRANSFORM) && Lst_IsEmpty(gn->commands) &&
 	Lst_IsEmpty(gn->children))
     {
@@ -858,7 +858,7 @@ SuffRebuildGraph(void *transformp, void 
 	     * Found target. Link in and return, since it can't be anything
 	     * else.
 	     */
-	    s2 = (Suff *)Lst_Datum(ln);
+	    s2 = Lst_DatumS(ln);
 	    SuffInsert(s2->children, s);
 	    SuffInsert(s->parents, s2);
 	    return 0;
@@ -885,7 +885,7 @@ SuffRebuildGraph(void *transformp, void 
 	    /*
 	     * Found it -- establish the proper relationship
 	     */
-	    s2 = (Suff *)Lst_Datum(ln);
+	    s2 = Lst_DatumS(ln);
 	    SuffInsert(s->children, s2);
 	    SuffInsert(s2->parents, s);
 	}
@@ -1035,7 +1035,7 @@ Suff_GetPath(char *sname)
     if (ln == NULL) {
 	return NULL;
     } else {
-	s = (Suff *)Lst_Datum(ln);
+	s = Lst_DatumS(ln);
 	return s->searchPath;
     }
 }
@@ -1073,7 +1073,7 @@ Suff_DoPaths(void)
 
     Lst_OpenS(sufflist);
     while ((ln = Lst_NextS(sufflist)) != NULL) {
-	s = (Suff *)Lst_Datum(ln);
+	s = Lst_DatumS(ln);
 	if (!Lst_IsEmpty (s->searchPath)) {
 #ifdef INCLUDES
 	    if (s->flags & SUFF_INCLUDE) {
@@ -1128,7 +1128,7 @@ Suff_AddInclude(char *sname)
 
     ln = Lst_Find(sufflist, sname, SuffSuffHasNameP);
     if (ln != NULL) {
-	s = (Suff *)Lst_Datum(ln);
+	s = Lst_DatumS(ln);
 	s->flags |= SUFF_INCLUDE;
     }
 }
@@ -1160,7 +1160,7 @@ Suff_AddLib(char *sname)
 
     ln = Lst_Find(sufflist, sname, SuffSuffHasNameP);
     if (ln != NULL) {
-	s = (Suff *)Lst_Datum(ln);
+	s = Lst_DatumS(ln);
 	s->flags |= SUFF_LIBRARY;
     }
 }
@@ -1296,7 +1296,7 @@ SuffRemoveSrc(Lst l)
 
 
     while ((ln = Lst_NextS(l)) != NULL) {
-	s = (Src *)Lst_Datum(ln);
+	s = Lst_DatumS(ln);
 	if (s->children == 0) {
 	    free(s->file);
 	    if (!s->parent)
@@ -1438,7 +1438,7 @@ SuffFindCmds(Src *targ, Lst slst)
 	    Lst_CloseS(t->children);
 	    return NULL;
 	}
-	s = (GNode *)Lst_Datum(ln);
+	s = Lst_DatumS(ln);
 
 	if (s->type & OP_OPTIONAL && Lst_IsEmpty(t->commands)) {
 	    /*
@@ -1472,7 +1472,7 @@ SuffFindCmds(Src *targ, Lst slst)
 	 *
 	 * XXX: Handle multi-stage transformations here, too.
 	 */
-	suff = (Suff *)Lst_Datum(ln);
+	suff = Lst_DatumS(ln);
 
 	if (Lst_Member(suff->parents, targ->suff) != NULL)
 	    break;
@@ -1528,7 +1528,7 @@ SuffFindCmds(Src *targ, Lst slst)
 static void
 SuffExpandChildren(LstNode cln, GNode *pgn)
 {
-    GNode   	*cgn = (GNode *)Lst_Datum(cln);
+    GNode   	*cgn = Lst_DatumS(cln);
     GNode	*gn;	    /* New source 8) */
     char	*cp;	    /* Expanded value */
 
@@ -1675,7 +1675,7 @@ SuffExpandChildren(LstNode cln, GNode *p
 static void
 SuffExpandWildcards(LstNode cln, GNode *pgn)
 {
-    GNode   	*cgn = (GNode *)Lst_Datum(cln);
+    GNode   	*cgn = Lst_DatumS(cln);
     GNode	*gn;	    /* New source 8) */
     char	*cp;	    /* Expanded value */
     Lst 	explist;    /* List of expansions */
@@ -1760,7 +1760,7 @@ Suff_FindPath(GNode* gn)
 	    fprintf(debug_file, "Wildcard expanding \"%s\"...", gn->name);
 	}
 	if (ln != NULL)
-	    suff = (Suff *)Lst_Datum(ln);
+	    suff = Lst_DatumS(ln);
 	/* XXX: Here we can save the suffix so we don't have to do this again */
     }
 
@@ -1831,7 +1831,7 @@ SuffApplyTransform(GNode *tGn, GNode *sG
 	return FALSE;
     }
 
-    gn = (GNode *)Lst_Datum(ln);
+    gn = Lst_DatumS(ln);
 
     if (DEBUG(SUFF)) {
 	fprintf(debug_file, "\tapplying %s -> %s to \"%s\"\n", s->name, t->name, tGn->name);
@@ -1995,11 +1995,11 @@ SuffFindArchiveDeps(GNode *gn, Lst slst)
 	    /*
 	     * Got one -- apply it
 	     */
-	    if (!SuffApplyTransform(gn, mem, (Suff *)Lst_Datum(ln), ms) &&
+	    if (!SuffApplyTransform(gn, mem, (Suff *)Lst_DatumS(ln), ms) &&
 		DEBUG(SUFF))
 	    {
 		fprintf(debug_file, "\tNo transformation from %s -> %s\n",
-		       ms->name, ((Suff *)Lst_Datum(ln))->name);
+		       ms->name, ((Suff *)Lst_DatumS(ln))->name);
 	    }
 	}
     }
@@ -2109,7 +2109,7 @@ SuffFindNormalDeps(GNode *gn, Lst slst)
 		 */
 		targ = bmake_malloc(sizeof(Src));
 		targ->file = bmake_strdup(gn->name);
-		targ->suff = (Suff *)Lst_Datum(ln);
+		targ->suff = Lst_DatumS(ln);
 		targ->suff->refCount++;
 		targ->node = gn;
 		targ->parent = NULL;
@@ -2196,7 +2196,7 @@ SuffFindNormalDeps(GNode *gn, Lst slst)
 	     * for setting the local variables.
 	     */
 	    if (!Lst_IsEmpty(targs)) {
-		targ = (Src *)Lst_Datum(Lst_First(targs));
+		targ = Lst_DatumS(Lst_First(targs));
 	    } else {
 		targ = NULL;
 	    }
@@ -2480,7 +2480,7 @@ SuffFindDeps(GNode *gn, Lst slst)
 	if (gn->suffix)
 	    gn->suffix->refCount--;
 	if (ln != NULL) {
-	    gn->suffix = s = (Suff *)Lst_Datum(ln);
+	    gn->suffix = s = Lst_DatumS(ln);
 	    gn->suffix->refCount++;
 	    Arch_FindLib(gn, s->searchPath);
 	} else {
@@ -2526,7 +2526,7 @@ Suff_SetNull(char *name)
 
     ln = Lst_Find(sufflist, name, SuffSuffHasNameP);
     if (ln != NULL) {
-	s = (Suff *)Lst_Datum(ln);
+	s = Lst_DatumS(ln);
 	if (suffNull != NULL) {
 	    suffNull->flags &= ~SUFF_NULL;
 	}

Index: src/usr.bin/make/targ.c
diff -u src/usr.bin/make/targ.c:1.69 src/usr.bin/make/targ.c:1.70
--- src/usr.bin/make/targ.c:1.69	Sat Aug 22 13:28:20 2020
+++ src/usr.bin/make/targ.c	Sat Aug 22 15:17:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: targ.c,v 1.69 2020/08/22 13:28:20 rillig Exp $	*/
+/*	$NetBSD: targ.c,v 1.70 2020/08/22 15:17:09 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: targ.c,v 1.69 2020/08/22 13:28:20 rillig Exp $";
+static char rcsid[] = "$NetBSD: targ.c,v 1.70 2020/08/22 15:17:09 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)targ.c	8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: targ.c,v 1.69 2020/08/22 13:28:20 rillig Exp $");
+__RCSID("$NetBSD: targ.c,v 1.70 2020/08/22 15:17:09 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -397,7 +397,7 @@ Targ_FindList(Lst names, int flags)
 
     Lst_OpenS(names);
     while ((ln = Lst_NextS(names)) != NULL) {
-	name = (char *)Lst_Datum(ln);
+	name = Lst_DatumS(ln);
 	gn = Targ_FindNode(name, flags);
 	if (gn != NULL) {
 	    /*

Reply via email to