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): remove trailing 'S' from names of Lst ...



details:   https://anonhg.NetBSD.org/src/rev/3f575497db93
branches:  trunk
changeset: 937846:3f575497db93
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Aug 28 04:48:56 2020 +0000

description:
make(1): remove trailing 'S' from names of Lst functions

The migration from null-passing Lst functions to argument-checking Lst
functions is completed.

There were 2 surprises: The targets list may be NULL, and in Dir_AddDir,
the path may be NULL.  The latter case is especially surprising since
that function turns into an almost-nop in that case.  This is another
case where probably 2 independent functions have been squeezed into a
single function.  This may be improved in a follow-up commit.

All other lists were fine.  They were always defined and thus didn't
need much work.

diffstat:

 usr.bin/make/arch.c   |   38 +++---
 usr.bin/make/compat.c |   28 ++--
 usr.bin/make/cond.c   |   10 +-
 usr.bin/make/dir.c    |  140 +++++++++++-----------
 usr.bin/make/job.c    |   32 ++--
 usr.bin/make/lst.c    |   76 ++++++------
 usr.bin/make/lst.h    |   58 ++++----
 usr.bin/make/main.c   |   54 ++++----
 usr.bin/make/make.c   |  142 +++++++++++-----------
 usr.bin/make/meta.c   |   48 +++---
 usr.bin/make/parse.c  |  118 +++++++++---------
 usr.bin/make/suff.c   |  312 +++++++++++++++++++++++++-------------------------
 usr.bin/make/targ.c   |   68 +++++-----
 13 files changed, 562 insertions(+), 562 deletions(-)

diffs (truncated from 3528 to 300 lines):

diff -r 0d170887654a -r 3f575497db93 usr.bin/make/arch.c
--- a/usr.bin/make/arch.c       Fri Aug 28 04:28:45 2020 +0000
+++ b/usr.bin/make/arch.c       Fri Aug 28 04:48:56 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: arch.c,v 1.100 2020/08/28 04:28:45 rillig Exp $        */
+/*     $NetBSD: arch.c,v 1.101 2020/08/28 04:48:56 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: arch.c,v 1.100 2020/08/28 04:28:45 rillig Exp $";
+static char rcsid[] = "$NetBSD: arch.c,v 1.101 2020/08/28 04:48:56 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.100 2020/08/28 04:28:45 rillig Exp $");
+__RCSID("$NetBSD: arch.c,v 1.101 2020/08/28 04:48:56 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -376,7 +376,7 @@
                    return FALSE;
                } else {
                    gn->type |= OP_ARCHV;
-                   Lst_AppendS(nodeLst, gn);
+                   Lst_Append(nodeLst, gn);
                }
            } else if (!Arch_ParseArchive(&sacrifice, nodeLst, ctxt)) {
                /*
@@ -396,8 +396,8 @@
 
            Buf_Init(&nameBuf, 0);
            Dir_Expand(memName, dirSearchPath, members);
-           while (!Lst_IsEmptyS(members)) {
-               char *member = Lst_DequeueS(members);
+           while (!Lst_IsEmpty(members)) {
+               char *member = Lst_Dequeue(members);
 
                Buf_Empty(&nameBuf);
                Buf_AddStr(&nameBuf, libName);
@@ -419,10 +419,10 @@
                     * end of the provided list.
                     */
                    gn->type |= OP_ARCHV;
-                   Lst_AppendS(nodeLst, gn);
+                   Lst_Append(nodeLst, gn);
                }
            }
-           Lst_FreeS(members);
+           Lst_Free(members);
            Buf_Destroy(&nameBuf, TRUE);
        } else {
            Buffer nameBuf;
@@ -446,7 +446,7 @@
                 * provided list.
                 */
                gn->type |= OP_ARCHV;
-               Lst_AppendS(nodeLst, gn);
+               Lst_Append(nodeLst, gn);
            }
        }
        if (doSubst) {
@@ -548,9 +548,9 @@
        member = base + 1;
     }
 
-    ln = Lst_FindS(archives, ArchFindArchive, archive);
+    ln = Lst_Find(archives, ArchFindArchive, archive);
     if (ln != NULL) {
-       ar = Lst_DatumS(ln);
+       ar = Lst_Datum(ln);
 
        he = Hash_FindEntry(&ar->members, member);
 
@@ -699,7 +699,7 @@
 
     fclose(arch);
 
-    Lst_AppendS(archives, ar);
+    Lst_Append(archives, ar);
 
     /*
      * Now that the archive has been read and cached, we can look into
@@ -1127,9 +1127,9 @@
     LstNode      ln;
     GNode        *pgn;
 
-    Lst_OpenS(gn->parents);
-    while ((ln = Lst_NextS(gn->parents)) != NULL) {
-       pgn = Lst_DatumS(ln);
+    Lst_Open(gn->parents);
+    while ((ln = Lst_Next(gn->parents)) != NULL) {
+       pgn = Lst_Datum(ln);
 
        if (pgn->type & OP_ARCHV) {
            /*
@@ -1157,7 +1157,7 @@
        }
     }
 
-    Lst_CloseS(gn->parents);
+    Lst_Close(gn->parents);
 
     return gn->mtime;
 }
@@ -1252,9 +1252,9 @@
 
     if (gn->type & OP_PHONY) {
        oodate = TRUE;
-    } else if (OP_NOP(gn->type) && Lst_IsEmptyS(gn->children)) {
+    } else if (OP_NOP(gn->type) && Lst_IsEmpty(gn->children)) {
        oodate = FALSE;
-    } else if ((!Lst_IsEmptyS(gn->children) && gn->cmgn == NULL) ||
+    } else if ((!Lst_IsEmpty(gn->children) && gn->cmgn == NULL) ||
               (gn->mtime > now) ||
               (gn->cmgn != NULL && gn->mtime < gn->cmgn->mtime)) {
        oodate = TRUE;
@@ -1300,7 +1300,7 @@
 Arch_End(void)
 {
 #ifdef CLEANUP
-    Lst_DestroyS(archives, ArchFree);
+    Lst_Destroy(archives, ArchFree);
 #endif
 }
 
diff -r 0d170887654a -r 3f575497db93 usr.bin/make/compat.c
--- a/usr.bin/make/compat.c     Fri Aug 28 04:28:45 2020 +0000
+++ b/usr.bin/make/compat.c     Fri Aug 28 04:48:56 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat.c,v 1.131 2020/08/27 19:15:35 rillig Exp $      */
+/*     $NetBSD: compat.c,v 1.132 2020/08/28 04:48:56 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: compat.c,v 1.131 2020/08/27 19:15:35 rillig Exp $";
+static char rcsid[] = "$NetBSD: compat.c,v 1.132 2020/08/28 04:48:56 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)compat.c   8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: compat.c,v 1.131 2020/08/27 19:15:35 rillig Exp $");
+__RCSID("$NetBSD: compat.c,v 1.132 2020/08/28 04:48:56 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -230,7 +230,7 @@
     errCheck = !(gn->type & OP_IGNORE);
     doIt = FALSE;
 
-    cmdNode = Lst_MemberS(gn->commands, cmd);
+    cmdNode = Lst_Member(gn->commands, cmd);
     cmdStart = Var_Subst(cmd, gn, VARE_WANTRES);
 
     /*
@@ -245,11 +245,11 @@
        return 0;
     }
     cmd = cmdStart;
-    LstNode_SetS(cmdNode, cmdStart);
+    LstNode_Set(cmdNode, cmdStart);
 
     if ((gn->type & OP_SAVE_CMDS) && (gn != ENDNode)) {
         assert(ENDNode != NULL);
-       Lst_AppendS(ENDNode->commands, cmdStart);
+       Lst_Append(ENDNode->commands, cmdStart);
        return 0;
     }
     if (strcmp(cmdStart, "...") == 0) {
@@ -394,7 +394,7 @@
 
     /* XXX: Memory management looks suspicious here. */
     /* XXX: Setting a list item to NULL is unexpected. */
-    LstNode_SetNullS(cmdNode);
+    LstNode_SetNull(cmdNode);
 
 #ifdef USE_META
     if (useMeta) {
@@ -532,14 +532,14 @@
        gn->made = BEINGMADE;
        if ((gn->type & OP_MADE) == 0)
            Suff_FindDeps(gn);
-       Lst_ForEachS(gn->children, Compat_Make, gn);
+       Lst_ForEach(gn->children, Compat_Make, gn);
        if ((gn->flags & REMAKE) == 0) {
            gn->made = ABORTED;
            pgn->flags &= ~(unsigned)REMAKE;
            goto cohorts;
        }
 
-       if (Lst_MemberS(gn->iParents, pgn) != NULL) {
+       if (Lst_Member(gn->iParents, pgn) != NULL) {
            char *p1;
            Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn);
            bmake_free(p1);
@@ -602,7 +602,7 @@
                    meta_job_start(NULL, gn);
                }
 #endif
-               Lst_ForEachS(gn->commands, CompatRunCommand, gn);
+               Lst_ForEach(gn->commands, CompatRunCommand, gn);
                curTarg = NULL;
            } else {
                Job_Touch(gn, gn->type & OP_SILENT);
@@ -643,7 +643,7 @@
         */
        pgn->flags &= ~(unsigned)REMAKE;
     } else {
-       if (Lst_MemberS(gn->iParents, pgn) != NULL) {
+       if (Lst_Member(gn->iParents, pgn) != NULL) {
            char *p1;
            Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn);
            bmake_free(p1);
@@ -671,7 +671,7 @@
     }
 
 cohorts:
-    Lst_ForEachS(gn->cohorts, Compat_Make, pgnp);
+    Lst_ForEach(gn->cohorts, Compat_Make, pgnp);
     return 0;
 }
 
@@ -747,8 +747,8 @@
      *                     could not be made due to errors.
      */
     errors = 0;
-    while (!Lst_IsEmptyS(targs)) {
-       gn = Lst_DequeueS(targs);
+    while (!Lst_IsEmpty(targs)) {
+       gn = Lst_Dequeue(targs);
        Compat_Make(gn, gn);
 
        if (gn->made == UPTODATE) {
diff -r 0d170887654a -r 3f575497db93 usr.bin/make/cond.c
--- a/usr.bin/make/cond.c       Fri Aug 28 04:28:45 2020 +0000
+++ b/usr.bin/make/cond.c       Fri Aug 28 04:48:56 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cond.c,v 1.102 2020/08/28 04:28:45 rillig Exp $        */
+/*     $NetBSD: cond.c,v 1.103 2020/08/28 04:48:56 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: cond.c,v 1.102 2020/08/28 04:28:45 rillig Exp $";
+static char rcsid[] = "$NetBSD: cond.c,v 1.103 2020/08/28 04:48:56 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)cond.c     8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: cond.c,v 1.102 2020/08/28 04:28:45 rillig Exp $");
+__RCSID("$NetBSD: cond.c,v 1.103 2020/08/28 04:48:56 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -284,7 +284,7 @@
 static Boolean
 CondDoMake(int argLen MAKE_ATTR_UNUSED, const char *arg)
 {
-    return Lst_FindS(create, CondFindStrMatch, arg) != NULL;
+    return Lst_Find(create, CondFindStrMatch, arg) != NULL;
 }
 
 /* See if the given file exists. */
@@ -326,7 +326,7 @@
     GNode *gn;
 
     gn = Targ_FindNode(arg, TARG_NOCREATE);
-    return gn != NULL && !OP_NOP(gn->type) && !Lst_IsEmptyS(gn->commands);
+    return gn != NULL && !OP_NOP(gn->type) && !Lst_IsEmpty(gn->commands);
 }
 
 /*-
diff -r 0d170887654a -r 3f575497db93 usr.bin/make/dir.c
--- a/usr.bin/make/dir.c        Fri Aug 28 04:28:45 2020 +0000
+++ b/usr.bin/make/dir.c        Fri Aug 28 04:48:56 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dir.c,v 1.118 2020/08/28 04:28:45 rillig Exp $ */
+/*     $NetBSD: dir.c,v 1.119 2020/08/28 04:48:57 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */



Home | Main Index | Thread Index | Old Index