Module Name:    src
Committed By:   rillig
Date:           Thu Aug 27 07:03:48 UTC 2020

Modified Files:
        src/usr.bin/make: lst.c parse.c suff.c

Log Message:
make(1): migrate Lst_Last to Lst_LastS


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/usr.bin/make/lst.c
cvs rdiff -u -r1.265 -r1.266 src/usr.bin/make/parse.c
cvs rdiff -u -r1.119 -r1.120 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.45 src/usr.bin/make/lst.c:1.46
--- src/usr.bin/make/lst.c:1.45	Thu Aug 27 07:00:29 2020
+++ src/usr.bin/make/lst.c	Thu Aug 27 07:03:48 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.c,v 1.45 2020/08/27 07:00:29 rillig Exp $ */
+/* $NetBSD: lst.c,v 1.46 2020/08/27 07:03:48 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.45 2020/08/27 07:00:29 rillig Exp $";
+static char rcsid[] = "$NetBSD: lst.c,v 1.46 2020/08/27 07:03:48 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: lst.c,v 1.45 2020/08/27 07:00:29 rillig Exp $");
+__RCSID("$NetBSD: lst.c,v 1.46 2020/08/27 07:03:48 rillig Exp $");
 #endif /* not lint */
 #endif
 
@@ -351,18 +351,6 @@ Lst_FirstS(Lst list)
     return list->first;
 }
 
-/* Return the last node from the given list, or NULL if the list is empty or
- * invalid. */
-LstNode
-Lst_Last(Lst list)
-{
-    if (!LstIsValid(list) || LstIsEmpty(list)) {
-	return NULL;
-    } else {
-	return list->last;
-    }
-}
-
 /* Return the last node from the given list, or NULL if the list is empty. */
 LstNode
 Lst_LastS(Lst list)

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.265 src/usr.bin/make/parse.c:1.266
--- src/usr.bin/make/parse.c:1.265	Thu Aug 27 06:53:57 2020
+++ src/usr.bin/make/parse.c	Thu Aug 27 07:03:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.265 2020/08/27 06:53:57 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.266 2020/08/27 07:03:48 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: parse.c,v 1.265 2020/08/27 06:53:57 rillig Exp $";
+static char rcsid[] = "$NetBSD: parse.c,v 1.266 2020/08/27 07:03:48 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.265 2020/08/27 06:53:57 rillig Exp $");
+__RCSID("$NetBSD: parse.c,v 1.266 2020/08/27 07:03:48 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -2088,7 +2088,7 @@ ParseAddCmd(void *gnp, void *cmd)
 
     /* Add to last (ie current) cohort for :: targets */
     if ((gn->type & OP_DOUBLEDEP) && !Lst_IsEmpty(gn->cohorts))
-	gn = Lst_DatumS(Lst_Last(gn->cohorts));
+	gn = Lst_DatumS(Lst_LastS(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.119 src/usr.bin/make/suff.c:1.120
--- src/usr.bin/make/suff.c:1.119	Thu Aug 27 07:00:29 2020
+++ src/usr.bin/make/suff.c	Thu Aug 27 07:03:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.119 2020/08/27 07:00:29 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.120 2020/08/27 07:03:48 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: suff.c,v 1.119 2020/08/27 07:00:29 rillig Exp $";
+static char rcsid[] = "$NetBSD: suff.c,v 1.120 2020/08/27 07:03:48 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.119 2020/08/27 07:00:29 rillig Exp $");
+__RCSID("$NetBSD: suff.c,v 1.120 2020/08/27 07:03:48 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -776,7 +776,7 @@ Suff_EndTransform(void *gnp, void *dummy
     GNode *gn = (GNode *)gnp;
 
     if ((gn->type & OP_DOUBLEDEP) && !Lst_IsEmpty(gn->cohorts))
-	gn = Lst_DatumS(Lst_Last(gn->cohorts));
+	gn = Lst_DatumS(Lst_LastS(gn->cohorts));
     if ((gn->type & OP_TRANSFORM) && Lst_IsEmpty(gn->commands) &&
 	Lst_IsEmpty(gn->children))
     {
@@ -1836,7 +1836,7 @@ SuffApplyTransform(GNode *tGn, GNode *sG
     /*
      * Record last child for expansion purposes
      */
-    ln = Lst_Last(tGn->children);
+    ln = Lst_LastS(tGn->children);
 
     /*
      * Pass the buck to Make_HandleUse to apply the rule

Reply via email to