Module Name: src Committed By: rillig Date: Fri Aug 28 04:14:31 UTC 2020
Modified Files: src/usr.bin/make: dir.c lst.c lst.h main.c make.c meta.c suff.c Log Message: make(1): migrate Lst_First to Lst_FirstS To generate a diff of this commit: cvs rdiff -u -r1.115 -r1.116 src/usr.bin/make/dir.c cvs rdiff -u -r1.47 -r1.48 src/usr.bin/make/lst.c cvs rdiff -u -r1.49 -r1.50 src/usr.bin/make/lst.h cvs rdiff -u -r1.317 -r1.318 src/usr.bin/make/main.c cvs rdiff -u -r1.127 -r1.128 src/usr.bin/make/make.c cvs rdiff -u -r1.103 -r1.104 src/usr.bin/make/meta.c cvs rdiff -u -r1.122 -r1.123 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.115 src/usr.bin/make/dir.c:1.116 --- src/usr.bin/make/dir.c:1.115 Thu Aug 27 19:15:35 2020 +++ src/usr.bin/make/dir.c Fri Aug 28 04:14:31 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.115 2020/08/27 19:15:35 rillig Exp $ */ +/* $NetBSD: dir.c,v 1.116 2020/08/28 04:14:31 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.115 2020/08/27 19:15:35 rillig Exp $"; +static char rcsid[] = "$NetBSD: dir.c,v 1.116 2020/08/28 04:14:31 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.115 2020/08/27 19:15:35 rillig Exp $"); +__RCSID("$NetBSD: dir.c,v 1.116 2020/08/28 04:14:31 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -483,7 +483,7 @@ Dir_SetPATH(void) Var_Delete(".PATH", VAR_GLOBAL); Lst_OpenS(dirSearchPath); - if ((ln = Lst_First(dirSearchPath)) != NULL) { + if ((ln = Lst_FirstS(dirSearchPath)) != NULL) { p = Lst_DatumS(ln); if (p == dotLast) { hasLastDot = TRUE; @@ -1137,7 +1137,7 @@ Dir_FindFile(const char *name, Lst path) } Lst_OpenS(path); - if ((ln = Lst_First(path)) != NULL) { + if ((ln = Lst_FirstS(path)) != NULL) { p = Lst_DatumS(ln); if (p == dotLast) { hasLastDot = TRUE; @@ -1764,7 +1764,7 @@ Dir_Concat(Lst path1, Lst path2) LstNode ln; Path *p; - for (ln = Lst_First(path2); ln != NULL; ln = Lst_SuccS(ln)) { + for (ln = Lst_FirstS(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/lst.c diff -u src/usr.bin/make/lst.c:1.47 src/usr.bin/make/lst.c:1.48 --- src/usr.bin/make/lst.c:1.47 Thu Aug 27 19:15:35 2020 +++ src/usr.bin/make/lst.c Fri Aug 28 04:14:31 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: lst.c,v 1.47 2020/08/27 19:15:35 rillig Exp $ */ +/* $NetBSD: lst.c,v 1.48 2020/08/28 04:14:31 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.47 2020/08/27 19:15:35 rillig Exp $"; +static char rcsid[] = "$NetBSD: lst.c,v 1.48 2020/08/28 04:14:31 rillig Exp $"; #else #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: lst.c,v 1.47 2020/08/27 19:15:35 rillig Exp $"); +__RCSID("$NetBSD: lst.c,v 1.48 2020/08/28 04:14:31 rillig Exp $"); #endif /* not lint */ #endif @@ -332,7 +332,7 @@ LstNode_SetNullS(LstNode node) /* Return the first node from the given list, or NULL if the list is empty or * invalid. */ -LstNode +static LstNode Lst_First(Lst list) { if (!LstIsValid(list) || LstIsEmpty(list)) { @@ -476,7 +476,7 @@ Lst_ForEachS(Lst list, LstActionProc pro { if (LstIsEmpty(list)) return 0; /* XXX: Document what this value means. */ - return Lst_ForEachFromS(list, Lst_First(list), proc, procData); + return Lst_ForEachFromS(list, Lst_FirstS(list), proc, procData); } /* Apply the given function to each element of the given list, starting from Index: src/usr.bin/make/lst.h diff -u src/usr.bin/make/lst.h:1.49 src/usr.bin/make/lst.h:1.50 --- src/usr.bin/make/lst.h:1.49 Thu Aug 27 19:15:35 2020 +++ src/usr.bin/make/lst.h Fri Aug 28 04:14:31 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: lst.h,v 1.49 2020/08/27 19:15:35 rillig Exp $ */ +/* $NetBSD: lst.h,v 1.50 2020/08/28 04:14:31 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -131,7 +131,6 @@ void Lst_MoveAllS(Lst, Lst); * Node-specific functions */ /* Return first element in list */ -LstNode Lst_First(Lst); LstNode Lst_FirstS(Lst); /* Return last element in list */ LstNode Lst_Last(Lst); Index: src/usr.bin/make/main.c diff -u src/usr.bin/make/main.c:1.317 src/usr.bin/make/main.c:1.318 --- src/usr.bin/make/main.c:1.317 Thu Aug 27 19:15:35 2020 +++ src/usr.bin/make/main.c Fri Aug 28 04:14:31 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.317 2020/08/27 19:15:35 rillig Exp $ */ +/* $NetBSD: main.c,v 1.318 2020/08/28 04:14:31 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,7 +69,7 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: main.c,v 1.317 2020/08/27 19:15:35 rillig Exp $"; +static char rcsid[] = "$NetBSD: main.c,v 1.318 2020/08/28 04:14:31 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.317 2020/08/27 19:15:35 rillig Exp $"); +__RCSID("$NetBSD: main.c,v 1.318 2020/08/28 04:14:31 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -869,7 +869,7 @@ doPrintVars(void) else expandVars = getBoolean(".MAKE.EXPAND_VARIABLES", FALSE); - for (ln = Lst_First(variables); ln != NULL; ln = Lst_SuccS(ln)) { + for (ln = Lst_FirstS(variables); ln != NULL; ln = Lst_SuccS(ln)) { char *var = Lst_DatumS(ln); const char *value; char *p1; @@ -1278,7 +1278,7 @@ main(int argc, char **argv) if (!Lst_IsEmptyS(create)) { LstNode ln; - for (ln = Lst_First(create); ln != NULL; ln = Lst_SuccS(ln)) { + for (ln = Lst_FirstS(create); ln != NULL; ln = Lst_SuccS(ln)) { char *name = Lst_DatumS(ln); Var_Append(".TARGETS", name, VAR_GLOBAL); } Index: src/usr.bin/make/make.c diff -u src/usr.bin/make/make.c:1.127 src/usr.bin/make/make.c:1.128 --- src/usr.bin/make/make.c:1.127 Thu Aug 27 19:15:35 2020 +++ src/usr.bin/make/make.c Fri Aug 28 04:14:31 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: make.c,v 1.127 2020/08/27 19:15:35 rillig Exp $ */ +/* $NetBSD: make.c,v 1.128 2020/08/28 04:14:31 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: make.c,v 1.127 2020/08/27 19:15:35 rillig Exp $"; +static char rcsid[] = "$NetBSD: make.c,v 1.128 2020/08/28 04:14:31 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.127 2020/08/27 19:15:35 rillig Exp $"); +__RCSID("$NetBSD: make.c,v 1.128 2020/08/28 04:14:31 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -735,7 +735,7 @@ Make_Update(GNode *cgn) parents = centurion->parents; /* If this was a .ORDER node, schedule the RHS */ - Lst_ForEachS(centurion->order_succ, MakeBuildParent, Lst_First(toBeMade)); + Lst_ForEachS(centurion->order_succ, MakeBuildParent, Lst_FirstS(toBeMade)); /* Now mark all the parents as having one less unmade child */ Lst_OpenS(parents); @@ -1121,7 +1121,7 @@ MakeStartJobs(void) * just before the current first element. */ gn->made = DEFERRED; - Lst_ForEachS(gn->children, MakeBuildChild, Lst_First(toBeMade)); + Lst_ForEachS(gn->children, MakeBuildChild, Lst_FirstS(toBeMade)); /* and drop this node on the floor */ if (DEBUG(MAKE)) fprintf(debug_file, "dropped %s%s\n", gn->name, gn->cohort_num); @@ -1451,7 +1451,7 @@ Make_ProcessWait(Lst targs) if (pgn->type & OP_DOUBLEDEP) Lst_PrependAllS(examine, pgn->cohorts); - owln = Lst_First(pgn->children); + owln = Lst_FirstS(pgn->children); Lst_OpenS(pgn->children); for (; (ln = Lst_NextS(pgn->children)) != NULL; ) { cgn = Lst_DatumS(ln); Index: src/usr.bin/make/meta.c diff -u src/usr.bin/make/meta.c:1.103 src/usr.bin/make/meta.c:1.104 --- src/usr.bin/make/meta.c:1.103 Thu Aug 27 19:15:35 2020 +++ src/usr.bin/make/meta.c Fri Aug 28 04:14:31 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: meta.c,v 1.103 2020/08/27 19:15:35 rillig Exp $ */ +/* $NetBSD: meta.c,v 1.104 2020/08/28 04:14:31 rillig Exp $ */ /* * Implement 'meta' mode. @@ -1167,7 +1167,7 @@ meta_oodate(GNode *gn, Boolean oodate) /* we want to track all the .meta we read */ Var_Append(".MAKE.META.FILES", fname, VAR_GLOBAL); - ln = Lst_First(gn->commands); + ln = Lst_FirstS(gn->commands); while (!oodate && (x = fgetLine(&buf, &bufsz, 0, fp)) > 0) { lineno++; if (buf[x - 1] == '\n') @@ -1598,7 +1598,7 @@ meta_oodate(GNode *gn, Boolean oodate) if (!Lst_IsEmptyS(missingFiles)) { if (DEBUG(META)) fprintf(debug_file, "%s: missing files: %s...\n", - fname, (char *)Lst_DatumS(Lst_First(missingFiles))); + fname, (char *)Lst_DatumS(Lst_FirstS(missingFiles))); oodate = TRUE; } if (!oodate && !have_filemon && filemonMissing) { Index: src/usr.bin/make/suff.c diff -u src/usr.bin/make/suff.c:1.122 src/usr.bin/make/suff.c:1.123 --- src/usr.bin/make/suff.c:1.122 Fri Aug 28 03:35:45 2020 +++ src/usr.bin/make/suff.c Fri Aug 28 04:14:31 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.122 2020/08/28 03:35:45 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.123 2020/08/28 04:14:31 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: suff.c,v 1.122 2020/08/28 03:35:45 rillig Exp $"; +static char rcsid[] = "$NetBSD: suff.c,v 1.123 2020/08/28 04:14:31 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.122 2020/08/28 03:35:45 rillig Exp $"); +__RCSID("$NetBSD: suff.c,v 1.123 2020/08/28 04:14:31 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -2062,7 +2062,7 @@ SuffFindNormalDeps(GNode *gn, Lst slst) /* * Begin at the beginning... */ - ln = Lst_First(sufflist); + ln = Lst_FirstS(sufflist); srcs = Lst_Init(); targs = Lst_Init(); @@ -2190,7 +2190,7 @@ SuffFindNormalDeps(GNode *gn, Lst slst) * for setting the local variables. */ if (!Lst_IsEmptyS(targs)) { - targ = Lst_DatumS(Lst_First(targs)); + targ = Lst_DatumS(Lst_FirstS(targs)); } else { targ = NULL; } @@ -2213,7 +2213,7 @@ SuffFindNormalDeps(GNode *gn, Lst slst) * Now we've got the important local variables set, expand any sources * that still contain variables or wildcards in their names. */ - for (ln = Lst_First(gn->children); ln != NULL; ln = nln) { + for (ln = Lst_FirstS(gn->children); ln != NULL; ln = nln) { nln = Lst_SuccS(ln); SuffExpandChildren(ln, gn); }