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): migrate Lst_Succ to Lst_SuccS



details:   https://anonhg.NetBSD.org/src/rev/3da949a46e31
branches:  trunk
changeset: 937810:3da949a46e31
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Aug 27 07:00:29 2020 +0000

description:
make(1): migrate Lst_Succ to Lst_SuccS

diffstat:

 usr.bin/make/dir.c  |   8 ++++----
 usr.bin/make/job.c  |   8 ++++----
 usr.bin/make/lst.c  |  17 +++--------------
 usr.bin/make/lst.h  |   3 +--
 usr.bin/make/main.c |  11 +++++------
 usr.bin/make/meta.c |   6 +++---
 usr.bin/make/suff.c |  16 ++++++++--------
 7 files changed, 28 insertions(+), 41 deletions(-)

diffs (265 lines):

diff -r 2110fba2d85a -r 3da949a46e31 usr.bin/make/dir.c
--- a/usr.bin/make/dir.c        Thu Aug 27 06:53:57 2020 +0000
+++ b/usr.bin/make/dir.c        Thu Aug 27 07:00:29 2020 +0000
@@ -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 @@
     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;
diff -r 2110fba2d85a -r 3da949a46e31 usr.bin/make/job.c
--- a/usr.bin/make/job.c        Thu Aug 27 06:53:57 2020 +0000
+++ b/usr.bin/make/job.c        Thu Aug 27 07:00:29 2020 +0000
@@ -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 @@
        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;
diff -r 2110fba2d85a -r 3da949a46e31 usr.bin/make/lst.c
--- a/usr.bin/make/lst.c        Thu Aug 27 06:53:57 2020 +0000
+++ b/usr.bin/make/lst.c        Thu Aug 27 07:00:29 2020 +0000
@@ -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 @@
 
 /* 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));
diff -r 2110fba2d85a -r 3da949a46e31 usr.bin/make/lst.h
--- a/usr.bin/make/lst.h        Thu Aug 27 06:53:57 2020 +0000
+++ b/usr.bin/make/lst.h        Thu Aug 27 07:00:29 2020 +0000
@@ -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_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);
diff -r 2110fba2d85a -r 3da949a46e31 usr.bin/make/main.c
--- a/usr.bin/make/main.c       Thu Aug 27 06:53:57 2020 +0000
+++ b/usr.bin/make/main.c       Thu Aug 27 07:00:29 2020 +0000
@@ -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 @@
 #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 @@
        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 @@
        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);
                }
diff -r 2110fba2d85a -r 3da949a46e31 usr.bin/make/meta.c
--- a/usr.bin/make/meta.c       Thu Aug 27 06:53:57 2020 +0000
+++ b/usr.bin/make/meta.c       Thu Aug 27 07:00:29 2020 +0000
@@ -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 @@
                            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 @@
                            oodate = TRUE;
                    }
                    free(cmd);
-                   ln = Lst_Succ(ln);
+                   ln = Lst_SuccS(ln);
                }
            } else if (strcmp(buf, "CWD") == 0) {
                /*
diff -r 2110fba2d85a -r 3da949a46e31 usr.bin/make/suff.c
--- a/usr.bin/make/suff.c       Thu Aug 27 06:53:57 2020 +0000
+++ b/usr.bin/make/suff.c       Thu Aug 27 07:00:29 2020 +0000
@@ -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 @@
        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 @@
     /*
      * 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 @@
                /*
                 * Search from this suffix's successor...
                 */
-               ln = Lst_Succ(ln);
+               ln = Lst_SuccS(ln);
            }
        }
 
@@ -2211,7 +2211,7 @@
      * 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);
     }
 



Home | Main Index | Thread Index | Old Index