Module Name:    src
Committed By:   rillig
Date:           Thu Aug 27 07:00:30 UTC 2020

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

Log Message:
make(1): migrate Lst_Succ to Lst_SuccS


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/usr.bin/make/dir.c
cvs rdiff -u -r1.217 -r1.218 src/usr.bin/make/job.c
cvs rdiff -u -r1.44 -r1.45 src/usr.bin/make/lst.c
cvs rdiff -u -r1.47 -r1.48 src/usr.bin/make/lst.h
cvs rdiff -u -r1.315 -r1.316 src/usr.bin/make/main.c
cvs rdiff -u -r1.101 -r1.102 src/usr.bin/make/meta.c
cvs rdiff -u -r1.118 -r1.119 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/dir.c
diff -u src/usr.bin/make/dir.c:1.113 src/usr.bin/make/dir.c:1.114
--- src/usr.bin/make/dir.c:1.113	Thu Aug 27 06:53:57 2020
+++ src/usr.bin/make/dir.c	Thu Aug 27 07:00:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dir.c,v 1.113 2020/08/27 06:53:57 rillig Exp $	*/
+/*	$NetBSD: dir.c,v 1.114 2020/08/27 07:00:29 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.113 2020/08/27 06:53:57 rillig Exp $";
+static char rcsid[] = "$NetBSD: dir.c,v 1.114 2020/08/27 07:00:29 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.113 2020/08/27 06:53:57 rillig Exp $");
+__RCSID("$NetBSD: dir.c,v 1.114 2020/08/27 07:00:29 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1764,7 +1764,7 @@ Dir_Concat(Lst path1, Lst path2)
     LstNode ln;
     Path *p;
 
-    for (ln = Lst_First(path2); ln != NULL; ln = Lst_Succ(ln)) {
+    for (ln = Lst_First(path2); ln != NULL; ln = Lst_SuccS(ln)) {
 	p = Lst_DatumS(ln);
 	if (Lst_MemberS(path1, p) == NULL) {
 	    p->refCount += 1;

Index: src/usr.bin/make/job.c
diff -u src/usr.bin/make/job.c:1.217 src/usr.bin/make/job.c:1.218
--- src/usr.bin/make/job.c:1.217	Thu Aug 27 06:53:57 2020
+++ src/usr.bin/make/job.c	Thu Aug 27 07:00:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.217 2020/08/27 06:53:57 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.218 2020/08/27 07:00:29 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: job.c,v 1.217 2020/08/27 06:53:57 rillig Exp $";
+static char rcsid[] = "$NetBSD: job.c,v 1.218 2020/08/27 07:00:29 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)job.c	8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: job.c,v 1.217 2020/08/27 06:53:57 rillig Exp $");
+__RCSID("$NetBSD: job.c,v 1.218 2020/08/27 07:00:29 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -711,7 +711,7 @@ JobPrintCommand(void *cmdp, void *jobp)
 	job->node->type |= OP_SAVE_CMDS;
 	if ((job->flags & JOB_IGNDOTS) == 0) {
 	    LstNode dotsNode = Lst_MemberS(job->node->commands, cmd);
-	    job->tailCmds = Lst_Succ(dotsNode);
+	    job->tailCmds = dotsNode != NULL ? Lst_SuccS(dotsNode) : NULL;
 	    return 1;
 	}
 	return 0;

Index: src/usr.bin/make/lst.c
diff -u src/usr.bin/make/lst.c:1.44 src/usr.bin/make/lst.c:1.45
--- src/usr.bin/make/lst.c:1.44	Thu Aug 27 06:53:57 2020
+++ src/usr.bin/make/lst.c	Thu Aug 27 07:00:29 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.c,v 1.44 2020/08/27 06:53:57 rillig Exp $ */
+/* $NetBSD: lst.c,v 1.45 2020/08/27 07:00:29 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.44 2020/08/27 06:53:57 rillig Exp $";
+static char rcsid[] = "$NetBSD: lst.c,v 1.45 2020/08/27 07:00:29 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: lst.c,v 1.44 2020/08/27 06:53:57 rillig Exp $");
+__RCSID("$NetBSD: lst.c,v 1.45 2020/08/27 07:00:29 rillig Exp $");
 #endif /* not lint */
 #endif
 
@@ -374,17 +374,6 @@ Lst_LastS(Lst list)
 
 /* Return the successor to the given node on its list, or NULL. */
 LstNode
-Lst_Succ(LstNode node)
-{
-    if (node == NULL) {
-	return NULL;
-    } else {
-	return node->next;
-    }
-}
-
-/* Return the successor to the given node on its list, or NULL. */
-LstNode
 Lst_SuccS(LstNode node)
 {
     assert(LstNodeIsValid(node));

Index: src/usr.bin/make/lst.h
diff -u src/usr.bin/make/lst.h:1.47 src/usr.bin/make/lst.h:1.48
--- src/usr.bin/make/lst.h:1.47	Thu Aug 27 06:53:57 2020
+++ src/usr.bin/make/lst.h	Thu Aug 27 07:00:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: lst.h,v 1.47 2020/08/27 06:53:57 rillig Exp $	*/
+/*	$NetBSD: lst.h,v 1.48 2020/08/27 07:00:29 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -138,7 +138,6 @@ LstNode		Lst_FirstS(Lst);
 LstNode		Lst_Last(Lst);
 LstNode		Lst_LastS(Lst);
 /* Return successor to given element */
-LstNode		Lst_Succ(LstNode);
 LstNode		Lst_SuccS(LstNode);
 /* Return predecessor to given element */
 LstNode		Lst_PrevS(LstNode);

Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.315 src/usr.bin/make/main.c:1.316
--- src/usr.bin/make/main.c:1.315	Thu Aug 27 06:53:57 2020
+++ src/usr.bin/make/main.c	Thu Aug 27 07:00:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.315 2020/08/27 06:53:57 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.316 2020/08/27 07:00:29 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.315 2020/08/27 06:53:57 rillig Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.316 2020/08/27 07:00:29 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.315 2020/08/27 06:53:57 rillig Exp $");
+__RCSID("$NetBSD: main.c,v 1.316 2020/08/27 07:00:29 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -869,8 +869,7 @@ doPrintVars(void)
 	else
 		expandVars = getBoolean(".MAKE.EXPAND_VARIABLES", FALSE);
 
-	for (ln = Lst_First(variables); ln != NULL;
-	    ln = Lst_Succ(ln)) {
+	for (ln = Lst_First(variables); ln != NULL; ln = Lst_SuccS(ln)) {
 		char *var = Lst_DatumS(ln);
 		const char *value;
 		char *p1;
@@ -1279,7 +1278,7 @@ main(int argc, char **argv)
 	if (!Lst_IsEmpty(create)) {
 		LstNode ln;
 
-		for (ln = Lst_First(create); ln != NULL; ln = Lst_Succ(ln)) {
+		for (ln = Lst_First(create); ln != NULL; ln = Lst_SuccS(ln)) {
 			char *name = Lst_DatumS(ln);
 			Var_Append(".TARGETS", name, VAR_GLOBAL);
 		}

Index: src/usr.bin/make/meta.c
diff -u src/usr.bin/make/meta.c:1.101 src/usr.bin/make/meta.c:1.102
--- src/usr.bin/make/meta.c:1.101	Thu Aug 27 06:53:57 2020
+++ src/usr.bin/make/meta.c	Thu Aug 27 07:00:29 2020
@@ -1,4 +1,4 @@
-/*      $NetBSD: meta.c,v 1.101 2020/08/27 06:53:57 rillig Exp $ */
+/*      $NetBSD: meta.c,v 1.102 2020/08/27 07:00:29 rillig Exp $ */
 
 /*
  * Implement 'meta' mode.
@@ -1340,7 +1340,7 @@ meta_oodate(GNode *gn, Boolean oodate)
 			    char *tp;
 
 			    do {
-				nln = Lst_FindFrom(missingFiles, Lst_Succ(ln),
+				nln = Lst_FindFrom(missingFiles, Lst_SuccS(ln),
 						   path_match, p);
 				tp = Lst_DatumS(ln);
 				Lst_RemoveS(missingFiles, ln);
@@ -1573,7 +1573,7 @@ meta_oodate(GNode *gn, Boolean oodate)
 			    oodate = TRUE;
 		    }
 		    free(cmd);
-		    ln = Lst_Succ(ln);
+		    ln = Lst_SuccS(ln);
 		}
 	    } else if (strcmp(buf, "CWD") == 0) {
 		/*

Index: src/usr.bin/make/suff.c
diff -u src/usr.bin/make/suff.c:1.118 src/usr.bin/make/suff.c:1.119
--- src/usr.bin/make/suff.c:1.118	Thu Aug 27 06:53:57 2020
+++ src/usr.bin/make/suff.c	Thu Aug 27 07:00:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.118 2020/08/27 06:53:57 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.119 2020/08/27 07:00:29 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: suff.c,v 1.118 2020/08/27 06:53:57 rillig Exp $";
+static char rcsid[] = "$NetBSD: suff.c,v 1.119 2020/08/27 07:00:29 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.118 2020/08/27 06:53:57 rillig Exp $");
+__RCSID("$NetBSD: suff.c,v 1.119 2020/08/27 07:00:29 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -621,7 +621,7 @@ SuffParseTransform(char *str, Suff **src
 	if (srcLn == NULL) {
 	    srcLn = Lst_FindS(sufflist, SuffSuffIsPrefix, str);
 	} else {
-	    srcLn = Lst_FindFrom(sufflist, Lst_Succ(srcLn),
+	    srcLn = Lst_FindFrom(sufflist, Lst_SuccS(srcLn),
 				 SuffSuffIsPrefix, str);
 	}
 	if (srcLn == NULL) {
@@ -1846,8 +1846,8 @@ SuffApplyTransform(GNode *tGn, GNode *sG
     /*
      * Deal with wildcards and variables in any acquired sources
      */
-    for (ln = Lst_Succ(ln); ln != NULL; ln = nln) {
-	nln = Lst_Succ(ln);
+    for (ln = ln != NULL ? Lst_SuccS(ln) : NULL; ln != NULL; ln = nln) {
+	nln = Lst_SuccS(ln);
 	SuffExpandChildren(ln, tGn);
     }
 
@@ -2132,7 +2132,7 @@ SuffFindNormalDeps(GNode *gn, Lst slst)
 		/*
 		 * Search from this suffix's successor...
 		 */
-		ln = Lst_Succ(ln);
+		ln = Lst_SuccS(ln);
 	    }
 	}
 
@@ -2211,7 +2211,7 @@ SuffFindNormalDeps(GNode *gn, Lst slst)
      * that still contain variables or wildcards in their names.
      */
     for (ln = Lst_First(gn->children); ln != NULL; ln = nln) {
-	nln = Lst_Succ(ln);
+	nln = Lst_SuccS(ln);
 	SuffExpandChildren(ln, gn);
     }
 

Reply via email to