Module Name: src
Committed By: rillig
Date: Fri Aug 28 04:48:57 UTC 2020
Modified Files:
src/usr.bin/make: arch.c compat.c cond.c dir.c job.c lst.c lst.h main.c
make.c meta.c parse.c suff.c targ.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/usr.bin/make/arch.c
cvs rdiff -u -r1.131 -r1.132 src/usr.bin/make/compat.c
cvs rdiff -u -r1.102 -r1.103 src/usr.bin/make/cond.c
cvs rdiff -u -r1.118 -r1.119 src/usr.bin/make/dir.c
cvs rdiff -u -r1.219 -r1.220 src/usr.bin/make/job.c
cvs rdiff -u -r1.49 -r1.50 src/usr.bin/make/lst.c
cvs rdiff -u -r1.52 -r1.53 src/usr.bin/make/lst.h
cvs rdiff -u -r1.319 -r1.320 src/usr.bin/make/main.c
cvs rdiff -u -r1.128 -r1.129 src/usr.bin/make/make.c
cvs rdiff -u -r1.105 -r1.106 src/usr.bin/make/meta.c
cvs rdiff -u -r1.267 -r1.268 src/usr.bin/make/parse.c
cvs rdiff -u -r1.124 -r1.125 src/usr.bin/make/suff.c
cvs rdiff -u -r1.75 -r1.76 src/usr.bin/make/targ.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/arch.c
diff -u src/usr.bin/make/arch.c:1.100 src/usr.bin/make/arch.c:1.101
--- src/usr.bin/make/arch.c:1.100 Fri Aug 28 04:28:45 2020
+++ src/usr.bin/make/arch.c Fri Aug 28 04:48:56 2020
@@ -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 @@ Arch_ParseArchive(char **linePtr, Lst no
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 @@ Arch_ParseArchive(char **linePtr, Lst no
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 @@ Arch_ParseArchive(char **linePtr, Lst no
* 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 @@ Arch_ParseArchive(char **linePtr, Lst no
* provided list.
*/
gn->type |= OP_ARCHV;
- Lst_AppendS(nodeLst, gn);
+ Lst_Append(nodeLst, gn);
}
}
if (doSubst) {
@@ -548,9 +548,9 @@ ArchStatMember(const char *archive, cons
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 @@ ArchStatMember(const char *archive, cons
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 @@ Arch_MemMTime(GNode *gn)
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 @@ Arch_MemMTime(GNode *gn)
}
}
- Lst_CloseS(gn->parents);
+ Lst_Close(gn->parents);
return gn->mtime;
}
@@ -1252,9 +1252,9 @@ Arch_LibOODate(GNode *gn)
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 @@ void
Arch_End(void)
{
#ifdef CLEANUP
- Lst_DestroyS(archives, ArchFree);
+ Lst_Destroy(archives, ArchFree);
#endif
}
Index: src/usr.bin/make/compat.c
diff -u src/usr.bin/make/compat.c:1.131 src/usr.bin/make/compat.c:1.132
--- src/usr.bin/make/compat.c:1.131 Thu Aug 27 19:15:35 2020
+++ src/usr.bin/make/compat.c Fri Aug 28 04:48:56 2020
@@ -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 @@ CompatRunCommand(void *cmdp, void *gnp)
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 @@ CompatRunCommand(void *cmdp, void *gnp)
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 @@ again:
/* 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 @@ Compat_Make(void *gnp, void *pgnp)
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 @@ Compat_Make(void *gnp, void *pgnp)
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 @@ Compat_Make(void *gnp, void *pgnp)
*/
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 @@ Compat_Make(void *gnp, void *pgnp)
}
cohorts:
- Lst_ForEachS(gn->cohorts, Compat_Make, pgnp);
+ Lst_ForEach(gn->cohorts, Compat_Make, pgnp);
return 0;
}
@@ -747,8 +747,8 @@ Compat_Run(Lst targs)
* 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) {
Index: src/usr.bin/make/cond.c
diff -u src/usr.bin/make/cond.c:1.102 src/usr.bin/make/cond.c:1.103
--- src/usr.bin/make/cond.c:1.102 Fri Aug 28 04:28:45 2020
+++ src/usr.bin/make/cond.c Fri Aug 28 04:48:56 2020
@@ -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 @@ CondFindStrMatch(const void *string, con
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 @@ CondDoCommands(int argLen MAKE_ATTR_UNUS
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);
}
/*-
Index: src/usr.bin/make/dir.c
diff -u src/usr.bin/make/dir.c:1.118 src/usr.bin/make/dir.c:1.119
--- src/usr.bin/make/dir.c:1.118 Fri Aug 28 04:28:45 2020
+++ src/usr.bin/make/dir.c Fri Aug 28 04:48:57 2020
@@ -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 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: dir.c,v 1.118 2020/08/28 04:28:45 rillig Exp $";
+static char rcsid[] = "$NetBSD: dir.c,v 1.119 2020/08/28 04:48:57 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.118 2020/08/28 04:28:45 rillig Exp $");
+__RCSID("$NetBSD: dir.c,v 1.119 2020/08/28 04:48:57 rillig Exp $");
#endif
#endif /* not lint */
#endif
@@ -417,8 +417,8 @@ Dir_InitDot(void)
LstNode ln;
/* Remove old entry from openDirectories, but do not destroy. */
- ln = Lst_MemberS(openDirectories, dot);
- Lst_RemoveS(openDirectories, ln);
+ ln = Lst_Member(openDirectories, dot);
+ Lst_Remove(openDirectories, ln);
}
dot = Dir_AddDir(NULL, ".");
@@ -461,9 +461,9 @@ Dir_End(void)
Dir_Destroy(dotLast);
Dir_Destroy(dot);
Dir_ClearPath(dirSearchPath);
- Lst_FreeS(dirSearchPath);
+ Lst_Free(dirSearchPath);
Dir_ClearPath(openDirectories);
- Lst_FreeS(openDirectories);
+ Lst_Free(openDirectories);
Hash_DeleteTable(&mtimes);
#endif
}
@@ -482,9 +482,9 @@ Dir_SetPATH(void)
Var_Delete(".PATH", VAR_GLOBAL);
- Lst_OpenS(dirSearchPath);
- if ((ln = Lst_FirstS(dirSearchPath)) != NULL) {
- p = Lst_DatumS(ln);
+ Lst_Open(dirSearchPath);
+ if ((ln = Lst_First(dirSearchPath)) != NULL) {
+ p = Lst_Datum(ln);
if (p == dotLast) {
hasLastDot = TRUE;
Var_Append(".PATH", dotLast->name, VAR_GLOBAL);
@@ -498,8 +498,8 @@ Dir_SetPATH(void)
Var_Append(".PATH", cur->name, VAR_GLOBAL);
}
- while ((ln = Lst_NextS(dirSearchPath)) != NULL) {
- p = Lst_DatumS(ln);
+ while ((ln = Lst_Next(dirSearchPath)) != NULL) {
+ p = Lst_Datum(ln);
if (p == dotLast)
continue;
if (p == dot && hasLastDot)
@@ -513,7 +513,7 @@ Dir_SetPATH(void)
if (cur)
Var_Append(".PATH", cur->name, VAR_GLOBAL);
}
- Lst_CloseS(dirSearchPath);
+ Lst_Close(dirSearchPath);
}
/*-
@@ -635,7 +635,7 @@ DirMatchFiles(const char *pattern, Path
((entry->name[0] != '.') ||
(pattern[0] == '.')))
{
- Lst_AppendS(expansions,
+ Lst_Append(expansions,
(isDot ? bmake_strdup(entry->name) :
str_concat3(p->name, "/", entry->name)));
}
@@ -762,7 +762,7 @@ DirExpandCurly(const char *word, const c
Dir_Expand(file, path, expansions);
free(file);
} else {
- Lst_AppendS(expansions, file);
+ Lst_Append(expansions, file);
}
piece = piece_end + 1; /* skip over the comma or closing brace */
@@ -795,12 +795,12 @@ DirExpandInt(const char *word, Lst path,
{
LstNode ln; /* Current node */
- Lst_OpenS(path);
- while ((ln = Lst_NextS(path)) != NULL) {
- Path *p = Lst_DatumS(ln);
+ Lst_Open(path);
+ while ((ln = Lst_Next(path)) != NULL) {
+ Path *p = Lst_Datum(ln);
DirMatchFiles(word, p, expansions);
}
- Lst_CloseS(path);
+ Lst_Close(path);
}
/* Print a word in the list of expansions.
@@ -897,7 +897,7 @@ Dir_Expand(const char *word, Lst path, L
path = Lst_Init();
(void)Dir_AddDir(path, dirpath);
DirExpandInt(cp + 1, path, expansions);
- Lst_FreeS(path);
+ Lst_Free(path);
}
} else {
/*
@@ -924,7 +924,7 @@ Dir_Expand(const char *word, Lst path, L
}
}
if (DEBUG(DIR)) {
- Lst_ForEachS(expansions, DirPrintWord, NULL);
+ Lst_ForEach(expansions, DirPrintWord, NULL);
fprintf(debug_file, "\n");
}
}
@@ -1136,9 +1136,9 @@ Dir_FindFile(const char *name, Lst path)
return NULL;
}
- Lst_OpenS(path);
- if ((ln = Lst_FirstS(path)) != NULL) {
- p = Lst_DatumS(ln);
+ Lst_Open(path);
+ if ((ln = Lst_First(path)) != NULL) {
+ p = Lst_Datum(ln);
if (p == dotLast) {
hasLastDot = TRUE;
DIR_DEBUG0("[dot last]...");
@@ -1167,26 +1167,26 @@ Dir_FindFile(const char *name, Lst path)
* specifies (fish.c) and what pmake finds (./fish.c).
*/
if (!hasLastDot && (file = DirFindDot(hasSlash, name, cp)) != NULL) {
- Lst_CloseS(path);
+ Lst_Close(path);
return file;
}
- while ((ln = Lst_NextS(path)) != NULL) {
- p = Lst_DatumS(ln);
+ while ((ln = Lst_Next(path)) != NULL) {
+ p = Lst_Datum(ln);
if (p == dotLast)
continue;
if ((file = DirLookup(p, name, cp, hasSlash)) != NULL) {
- Lst_CloseS(path);
+ Lst_Close(path);
return file;
}
}
if (hasLastDot && (file = DirFindDot(hasSlash, name, cp)) != NULL) {
- Lst_CloseS(path);
+ Lst_Close(path);
return file;
}
}
- Lst_CloseS(path);
+ Lst_Close(path);
/*
* We didn't find the file on any directory in the search path.
@@ -1228,9 +1228,9 @@ Dir_FindFile(const char *name, Lst path)
return file;
}
- Lst_OpenS(path);
- while ((ln = Lst_NextS(path)) != NULL) {
- p = Lst_DatumS(ln);
+ Lst_Open(path);
+ while ((ln = Lst_Next(path)) != NULL) {
+ p = Lst_Datum(ln);
if (p == dotLast)
continue;
if (p == dot) {
@@ -1239,11 +1239,11 @@ Dir_FindFile(const char *name, Lst path)
checkedDot = TRUE;
}
if ((file = DirLookupSubdir(p, name)) != NULL) {
- Lst_CloseS(path);
+ Lst_Close(path);
return file;
}
}
- Lst_CloseS(path);
+ Lst_Close(path);
if (hasLastDot) {
if (dot && !checkedDot) {
@@ -1286,13 +1286,13 @@ Dir_FindFile(const char *name, Lst path)
return file;
}
- Lst_OpenS(path);
- while ((ln = Lst_NextS(path)) != NULL) {
- p = Lst_DatumS(ln);
+ Lst_Open(path);
+ while ((ln = Lst_Next(path)) != NULL) {
+ p = Lst_Datum(ln);
if (p == dotLast)
continue;
if ((file = DirLookupAbs(p, name, cp)) != NULL) {
- Lst_CloseS(path);
+ Lst_Close(path);
if (file[0] == '\0') {
free(file);
return NULL;
@@ -1300,7 +1300,7 @@ Dir_FindFile(const char *name, Lst path)
return file;
}
}
- Lst_CloseS(path);
+ Lst_Close(path);
if (hasLastDot && cur &&
((file = DirLookupAbs(cur, name, cp)) != NULL)) {
@@ -1339,11 +1339,11 @@ Dir_FindFile(const char *name, Lst path)
cp[-1] = '/';
bigmisses += 1;
- ln = Lst_LastS(path);
+ ln = Lst_Last(path);
if (ln == NULL) {
return NULL;
} else {
- p = Lst_DatumS(ln);
+ p = Lst_Datum(ln);
}
if (Hash_FindEntry(&p->files, cp) != NULL) {
@@ -1478,7 +1478,7 @@ Dir_MTime(GNode *gn, Boolean recheck)
else {
fullName = Dir_FindFile(gn->name, Suff_FindPath(gn));
if (fullName == NULL && gn->flags & FROM_DEPEND &&
- !Lst_IsEmptyS(gn->iParents)) {
+ !Lst_IsEmpty(gn->iParents)) {
char *cp;
cp = strrchr(gn->name, '/');
@@ -1565,25 +1565,25 @@ Dir_AddDir(Lst path, const char *name)
struct dirent *dp; /* entry in directory */
if (strcmp(name, ".DOTLAST") == 0) {
- ln = path != NULL ? Lst_FindS(path, DirFindName, name) : NULL;
+ ln = path != NULL ? Lst_Find(path, DirFindName, name) : NULL;
if (ln != NULL)
- return Lst_DatumS(ln);
+ return Lst_Datum(ln);
else {
/* XXX: It is wrong to increment the refCount if dotLast is not
* used afterwards. */
dotLast->refCount += 1;
if (path != NULL)
- Lst_PrependS(path, dotLast);
+ Lst_Prepend(path, dotLast);
}
}
if (path)
- ln = Lst_FindS(openDirectories, DirFindName, name);
+ ln = Lst_Find(openDirectories, DirFindName, name);
if (ln != NULL) {
- p = Lst_DatumS(ln);
- if (path && Lst_MemberS(path, p) == NULL) {
+ p = Lst_Datum(ln);
+ if (path && Lst_Member(path, p) == NULL) {
p->refCount += 1;
- Lst_AppendS(path, p);
+ Lst_Append(path, p);
}
} else {
DIR_DEBUG1("Caching %s ...", name);
@@ -1609,9 +1609,9 @@ Dir_AddDir(Lst path, const char *name)
(void)Hash_CreateEntry(&p->files, dp->d_name, NULL);
}
(void)closedir(d);
- Lst_AppendS(openDirectories, p);
+ Lst_Append(openDirectories, p);
if (path != NULL)
- Lst_AppendS(path, p);
+ Lst_Append(path, p);
}
DIR_DEBUG0("done\n");
}
@@ -1621,7 +1621,7 @@ Dir_AddDir(Lst path, const char *name)
/*-
*-----------------------------------------------------------------------
* Dir_CopyDir --
- * Callback function for duplicating a search path via Lst_CopyS.
+ * Callback function for duplicating a search path via Lst_Copy.
* Ups the reference count for the directory.
*
* Results:
@@ -1666,14 +1666,14 @@ Dir_MakeFlags(const char *flag, Lst path
Buf_Init(&buf, 0);
if (path != NULL) {
- Lst_OpenS(path);
- while ((ln = Lst_NextS(path)) != NULL) {
- Path *p = Lst_DatumS(ln);
+ Lst_Open(path);
+ while ((ln = Lst_Next(path)) != NULL) {
+ Path *p = Lst_Datum(ln);
Buf_AddStr(&buf, " ");
Buf_AddStr(&buf, flag);
Buf_AddStr(&buf, p->name);
}
- Lst_CloseS(path);
+ Lst_Close(path);
}
return Buf_Destroy(&buf, FALSE);
@@ -1706,8 +1706,8 @@ Dir_Destroy(void *pp)
if (p->refCount == 0) {
LstNode ln;
- ln = Lst_MemberS(openDirectories, p);
- Lst_RemoveS(openDirectories, ln);
+ ln = Lst_Member(openDirectories, p);
+ Lst_Remove(openDirectories, ln);
Hash_DeleteTable(&p->files);
free(p->name);
@@ -1735,8 +1735,8 @@ Dir_Destroy(void *pp)
void
Dir_ClearPath(Lst path)
{
- while (!Lst_IsEmptyS(path)) {
- Path *p = Lst_DequeueS(path);
+ while (!Lst_IsEmpty(path)) {
+ Path *p = Lst_Dequeue(path);
Dir_Destroy(p);
}
}
@@ -1766,11 +1766,11 @@ Dir_Concat(Lst path1, Lst path2)
LstNode ln;
Path *p;
- for (ln = Lst_FirstS(path2); ln != NULL; ln = Lst_SuccS(ln)) {
- p = Lst_DatumS(ln);
- if (Lst_MemberS(path1, p) == NULL) {
+ for (ln = Lst_First(path2); ln != NULL; ln = Lst_Succ(ln)) {
+ p = Lst_Datum(ln);
+ if (Lst_Member(path1, p) == NULL) {
p->refCount += 1;
- Lst_AppendS(path1, p);
+ Lst_Append(path1, p);
}
}
}
@@ -1794,13 +1794,13 @@ Dir_PrintDirectories(void)
percentage(hits, hits + bigmisses + nearmisses));
fprintf(debug_file, "# %-20s referenced\thits\n", "directory");
- Lst_OpenS(openDirectories);
- while ((ln = Lst_NextS(openDirectories)) != NULL) {
- Path *p = Lst_DatumS(ln);
+ Lst_Open(openDirectories);
+ while ((ln = Lst_Next(openDirectories)) != NULL) {
+ Path *p = Lst_Datum(ln);
fprintf(debug_file, "# %-20s %10d\t%4d\n", p->name, p->refCount,
p->hits);
}
- Lst_CloseS(openDirectories);
+ Lst_Close(openDirectories);
}
static int
@@ -1813,5 +1813,5 @@ DirPrintDir(void *p, void *dummy MAKE_AT
void
Dir_PrintPath(Lst path)
{
- Lst_ForEachS(path, DirPrintDir, NULL);
+ Lst_ForEach(path, DirPrintDir, NULL);
}
Index: src/usr.bin/make/job.c
diff -u src/usr.bin/make/job.c:1.219 src/usr.bin/make/job.c:1.220
--- src/usr.bin/make/job.c:1.219 Thu Aug 27 19:15:35 2020
+++ src/usr.bin/make/job.c Fri Aug 28 04:48:57 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: job.c,v 1.219 2020/08/27 19:15:35 rillig Exp $ */
+/* $NetBSD: job.c,v 1.220 2020/08/28 04:48:57 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.219 2020/08/27 19:15:35 rillig Exp $";
+static char rcsid[] = "$NetBSD: job.c,v 1.220 2020/08/28 04:48:57 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.219 2020/08/27 19:15:35 rillig Exp $");
+__RCSID("$NetBSD: job.c,v 1.220 2020/08/28 04:48:57 rillig Exp $");
#endif
#endif /* not lint */
#endif
@@ -710,8 +710,8 @@ JobPrintCommand(void *cmdp, void *jobp)
if (strcmp(cmd, "...") == 0) {
job->node->type |= OP_SAVE_CMDS;
if ((job->flags & JOB_IGNDOTS) == 0) {
- LstNode dotsNode = Lst_MemberS(job->node->commands, cmd);
- job->tailCmds = dotsNode != NULL ? Lst_SuccS(dotsNode) : NULL;
+ LstNode dotsNode = Lst_Member(job->node->commands, cmd);
+ job->tailCmds = dotsNode != NULL ? Lst_Succ(dotsNode) : NULL;
return 1;
}
return 0;
@@ -914,7 +914,7 @@ static int
JobSaveCommand(void *cmd, void *gn)
{
cmd = Var_Subst((char *)cmd, (GNode *)gn, VARE_WANTRES);
- Lst_AppendS(postCommands->commands, cmd);
+ Lst_Append(postCommands->commands, cmd);
return 0;
}
@@ -1101,7 +1101,7 @@ JobFinish(Job *job, int status)
* on the .END target.
*/
if (job->tailCmds != NULL) {
- Lst_ForEachFromS(job->node->commands, job->tailCmds,
+ Lst_ForEachFrom(job->node->commands, job->tailCmds,
JobSaveCommand,
job->node);
}
@@ -1234,13 +1234,13 @@ Job_Touch(GNode *gn, Boolean silent)
Boolean
Job_CheckCommands(GNode *gn, void (*abortProc)(const char *, ...))
{
- if (OP_NOP(gn->type) && Lst_IsEmptyS(gn->commands) &&
- ((gn->type & OP_LIB) == 0 || Lst_IsEmptyS(gn->children))) {
+ if (OP_NOP(gn->type) && Lst_IsEmpty(gn->commands) &&
+ ((gn->type & OP_LIB) == 0 || Lst_IsEmpty(gn->children))) {
/*
* No commands. Look for .DEFAULT rule from which we might infer
* commands
*/
- if ((DEFAULT != NULL) && !Lst_IsEmptyS(DEFAULT->commands) &&
+ if ((DEFAULT != NULL) && !Lst_IsEmpty(DEFAULT->commands) &&
(gn->type & OP_SPECIAL) == 0) {
char *p1;
/*
@@ -1655,7 +1655,7 @@ JobStart(GNode *gn, int flags)
* We can do all the commands at once. hooray for sanity
*/
numCommands = 0;
- Lst_ForEachS(gn->commands, JobPrintCommand, job);
+ Lst_ForEach(gn->commands, JobPrintCommand, job);
/*
* If we didn't print out any commands to the shell script,
@@ -1682,7 +1682,7 @@ JobStart(GNode *gn, int flags)
* doesn't do any harm in this case and may do some good.
*/
if (cmdsOK) {
- Lst_ForEachS(gn->commands, JobPrintCommand, job);
+ Lst_ForEach(gn->commands, JobPrintCommand, job);
}
/*
* Don't execute the shell, thank you.
@@ -1724,7 +1724,7 @@ JobStart(GNode *gn, int flags)
*/
if (cmdsOK && aborting == 0) {
if (job->tailCmds != NULL) {
- Lst_ForEachFromS(job->node->commands, job->tailCmds,
+ Lst_ForEachFrom(job->node->commands, job->tailCmds,
JobSaveCommand,
job->node);
}
@@ -1968,7 +1968,7 @@ JobRun(GNode *targ)
* the nice side effect that it avoids a lot of other problems.
*/
Lst lst = Lst_Init();
- Lst_AppendS(lst, targ);
+ Lst_Append(lst, targ);
(void)Make_Run(lst);
Lst_Destroy(lst, NULL);
JobStart(targ, JOB_SPECIAL);
@@ -2671,8 +2671,8 @@ int
Job_Finish(void)
{
if (postCommands != NULL &&
- (!Lst_IsEmptyS(postCommands->commands) ||
- !Lst_IsEmptyS(postCommands->children))) {
+ (!Lst_IsEmpty(postCommands->commands) ||
+ !Lst_IsEmpty(postCommands->children))) {
if (errors) {
Error("Errors reported so .END ignored");
} else {
Index: src/usr.bin/make/lst.c
diff -u src/usr.bin/make/lst.c:1.49 src/usr.bin/make/lst.c:1.50
--- src/usr.bin/make/lst.c:1.49 Fri Aug 28 04:28:45 2020
+++ src/usr.bin/make/lst.c Fri Aug 28 04:48:57 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.c,v 1.49 2020/08/28 04:28:45 rillig Exp $ */
+/* $NetBSD: lst.c,v 1.50 2020/08/28 04:48:57 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.49 2020/08/28 04:28:45 rillig Exp $";
+static char rcsid[] = "$NetBSD: lst.c,v 1.50 2020/08/28 04:48:57 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: lst.c,v 1.49 2020/08/28 04:28:45 rillig Exp $");
+__RCSID("$NetBSD: lst.c,v 1.50 2020/08/28 04:48:57 rillig Exp $");
#endif /* not lint */
#endif
@@ -125,7 +125,7 @@ Lst_Init(void)
* If copyProc is given, that function is used to create the new datum from the
* old datum, usually by creating a copy of it. */
Lst
-Lst_CopyS(Lst list, LstCopyProc copyProc)
+Lst_Copy(Lst list, LstCopyProc copyProc)
{
Lst newList;
LstNode node;
@@ -136,7 +136,7 @@ Lst_CopyS(Lst list, LstCopyProc copyProc
for (node = list->first; node != NULL; node = node->next) {
void *datum = copyProc != NULL ? copyProc(node->datum) : node->datum;
- Lst_AppendS(newList, datum);
+ Lst_Append(newList, datum);
}
return newList;
@@ -144,7 +144,7 @@ Lst_CopyS(Lst list, LstCopyProc copyProc
/* Free a list and all its nodes. The list data itself are not freed though. */
void
-Lst_FreeS(Lst list)
+Lst_Free(Lst list)
{
LstNode node;
LstNode next;
@@ -162,7 +162,7 @@ Lst_FreeS(Lst list)
/* Destroy a list and free all its resources. If the freeProc is given, it is
* called with the datum from each node in turn before the node is freed. */
void
-Lst_DestroyS(Lst list, LstFreeProc freeProc)
+Lst_Destroy(Lst list, LstFreeProc freeProc)
{
LstNode node;
LstNode next;
@@ -186,7 +186,7 @@ Lst_DestroyS(Lst list, LstFreeProc freeP
/* Insert a new node with the given piece of data before the given node in the
* given list. */
void
-Lst_InsertBeforeS(Lst list, LstNode node, void *datum)
+Lst_InsertBefore(Lst list, LstNode node, void *datum)
{
LstNode newNode;
@@ -211,7 +211,7 @@ Lst_InsertBeforeS(Lst list, LstNode node
/* Add a piece of data at the start of the given list. */
void
-Lst_PrependS(Lst list, void *datum)
+Lst_Prepend(Lst list, void *datum)
{
LstNode node;
@@ -233,7 +233,7 @@ Lst_PrependS(Lst list, void *datum)
/* Add a piece of data at the end of the given list. */
void
-Lst_AppendS(Lst list, void *datum)
+Lst_Append(Lst list, void *datum)
{
LstNode node;
@@ -256,7 +256,7 @@ Lst_AppendS(Lst list, void *datum)
/* Remove the given node from the given list.
* The datum stored in the node must be freed by the caller, if necessary. */
void
-Lst_RemoveS(Lst list, LstNode node)
+Lst_Remove(Lst list, LstNode node)
{
assert(LstIsValid(list));
assert(LstNodeIsValid(node));
@@ -308,7 +308,7 @@ Lst_RemoveS(Lst list, LstNode node)
/* Replace the datum in the given node with the new datum. */
void
-LstNode_SetS(LstNode node, void *datum)
+LstNode_Set(LstNode node, void *datum)
{
assert(LstNodeIsValid(node));
assert(datum != NULL);
@@ -318,7 +318,7 @@ LstNode_SetS(LstNode node, void *datum)
/* Replace the datum in the given node to NULL. */
void
-LstNode_SetNullS(LstNode node)
+LstNode_SetNull(LstNode node)
{
assert(LstNodeIsValid(node));
@@ -332,7 +332,7 @@ LstNode_SetNullS(LstNode node)
/* Return the first node from the given list, or NULL if the list is empty. */
LstNode
-Lst_FirstS(Lst list)
+Lst_First(Lst list)
{
assert(LstIsValid(list));
@@ -341,7 +341,7 @@ Lst_FirstS(Lst list)
/* Return the last node from the given list, or NULL if the list is empty. */
LstNode
-Lst_LastS(Lst list)
+Lst_Last(Lst list)
{
assert(LstIsValid(list));
@@ -350,7 +350,7 @@ Lst_LastS(Lst list)
/* Return the successor to the given node on its list, or NULL. */
LstNode
-Lst_SuccS(LstNode node)
+Lst_Succ(LstNode node)
{
assert(LstNodeIsValid(node));
@@ -359,7 +359,7 @@ Lst_SuccS(LstNode node)
/* Return the predecessor to the given node on its list, or NULL. */
LstNode
-Lst_PrevS(LstNode node)
+Lst_Prev(LstNode node)
{
assert(LstNodeIsValid(node));
return node->prev;
@@ -367,7 +367,7 @@ Lst_PrevS(LstNode node)
/* Return the datum stored in the given node. */
void *
-Lst_DatumS(LstNode node)
+Lst_Datum(LstNode node)
{
assert(LstNodeIsValid(node));
return node->datum;
@@ -380,7 +380,7 @@ Lst_DatumS(LstNode node)
/* Return TRUE if the given list is empty. */
Boolean
-Lst_IsEmptyS(Lst list)
+Lst_IsEmpty(Lst list)
{
assert(LstIsValid(list));
@@ -390,18 +390,18 @@ Lst_IsEmptyS(Lst list)
/* Return the first node from the given list for which the given comparison
* function returns 0, or NULL if none of the nodes matches. */
LstNode
-Lst_FindS(Lst list, LstFindProc cmp, const void *cmpData)
+Lst_Find(Lst list, LstFindProc cmp, const void *cmpData)
{
if (LstIsEmpty(list))
return NULL;
- return Lst_FindFromS(list, Lst_FirstS(list), cmp, cmpData);
+ return Lst_FindFrom(list, Lst_First(list), cmp, cmpData);
}
/* Return the first node from the given list, starting at the given node, for
* which the given comparison function returns 0, or NULL if none of the nodes
* matches. */
LstNode
-Lst_FindFromS(Lst list, LstNode node, LstFindProc cmp, const void *cmpData)
+Lst_FindFrom(Lst list, LstNode node, LstFindProc cmp, const void *cmpData)
{
LstNode tln;
@@ -419,7 +419,7 @@ Lst_FindFromS(Lst list, LstNode node, Ls
/* Return the first node that contains the given datum, or NULL. */
LstNode
-Lst_MemberS(Lst list, void *datum)
+Lst_Member(Lst list, void *datum)
{
LstNode node;
@@ -439,18 +439,18 @@ Lst_MemberS(Lst list, void *datum)
* should return 0 if traversal should continue and non-zero if it should
* abort. */
int
-Lst_ForEachS(Lst list, LstActionProc proc, void *procData)
+Lst_ForEach(Lst list, LstActionProc proc, void *procData)
{
if (LstIsEmpty(list))
return 0; /* XXX: Document what this value means. */
- return Lst_ForEachFromS(list, Lst_FirstS(list), proc, procData);
+ return Lst_ForEachFrom(list, Lst_First(list), proc, procData);
}
/* Apply the given function to each element of the given list, starting from
* the given node. The function should return 0 if traversal should continue,
* and non-zero if it should abort. */
int
-Lst_ForEachFromS(Lst list, LstNode node,
+Lst_ForEachFrom(Lst list, LstNode node,
LstActionProc proc, void *procData)
{
LstNode tln = node;
@@ -504,7 +504,7 @@ Lst_ForEachFromS(Lst list, LstNode node,
/* Move all nodes from list2 to the end of list1.
* List2 is destroyed and freed. */
void
-Lst_MoveAllS(Lst list1, Lst list2)
+Lst_MoveAll(Lst list1, Lst list2)
{
assert(LstIsValid(list1));
assert(LstIsValid(list2));
@@ -523,20 +523,20 @@ Lst_MoveAllS(Lst list1, Lst list2)
/* Copy the element data from src to the start of dst. */
void
-Lst_PrependAllS(Lst dst, Lst src)
+Lst_PrependAll(Lst dst, Lst src)
{
LstNode node;
for (node = src->last; node != NULL; node = node->prev)
- Lst_PrependS(dst, node->datum);
+ Lst_Prepend(dst, node->datum);
}
/* Copy the element data from src to the end of dst. */
void
-Lst_AppendAllS(Lst dst, Lst src)
+Lst_AppendAll(Lst dst, Lst src)
{
LstNode node;
for (node = src->first; node != NULL; node = node->next)
- Lst_AppendS(dst, node->datum);
+ Lst_Append(dst, node->datum);
}
/*
@@ -552,7 +552,7 @@ Lst_AppendAllS(Lst dst, Lst src)
/* Open a list for sequential access. A list can still be searched, etc.,
* without confusing these functions. */
void
-Lst_OpenS(Lst list)
+Lst_Open(Lst list)
{
assert(LstIsValid(list));
@@ -570,7 +570,7 @@ Lst_OpenS(Lst list)
/* Return the next node for the given list, or NULL if the end has been
* reached. */
LstNode
-Lst_NextS(Lst list)
+Lst_Next(Lst list)
{
LstNode node;
@@ -614,7 +614,7 @@ Lst_NextS(Lst list)
/* Close a list which was opened for sequential access. */
void
-Lst_CloseS(Lst list)
+Lst_Close(Lst list)
{
assert(LstIsValid(list));
assert(list->isOpen);
@@ -630,14 +630,14 @@ Lst_CloseS(Lst list)
/* Add the datum to the tail of the given list. */
void
-Lst_EnqueueS(Lst list, void *datum)
+Lst_Enqueue(Lst list, void *datum)
{
- Lst_AppendS(list, datum);
+ Lst_Append(list, datum);
}
/* Remove and return the datum at the head of the given list. */
void *
-Lst_DequeueS(Lst list)
+Lst_Dequeue(Lst list)
{
void *datum;
@@ -645,7 +645,7 @@ Lst_DequeueS(Lst list)
assert(!LstIsEmpty(list));
datum = list->first->datum;
- Lst_RemoveS(list, list->first);
+ Lst_Remove(list, list->first);
assert(datum != NULL);
return datum;
}
Index: src/usr.bin/make/lst.h
diff -u src/usr.bin/make/lst.h:1.52 src/usr.bin/make/lst.h:1.53
--- src/usr.bin/make/lst.h:1.52 Fri Aug 28 04:28:45 2020
+++ src/usr.bin/make/lst.h Fri Aug 28 04:48:57 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.h,v 1.52 2020/08/28 04:28:45 rillig Exp $ */
+/* $NetBSD: lst.h,v 1.53 2020/08/28 04:48:57 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -101,80 +101,80 @@ typedef int LstActionProc(void *, void *
/* Create a new list */
Lst Lst_Init(void);
/* Duplicate an existing list */
-Lst Lst_CopyS(Lst, LstCopyProc);
+Lst Lst_Copy(Lst, LstCopyProc);
/* Destroy an old one */
-void Lst_FreeS(Lst);
-void Lst_DestroyS(Lst, LstFreeProc);
+void Lst_Free(Lst);
+void Lst_Destroy(Lst, LstFreeProc);
/* True if list is empty */
-Boolean Lst_IsEmptyS(Lst);
+Boolean Lst_IsEmpty(Lst);
/*
* Functions to modify a list
*/
/* Insert an element before another */
-void Lst_InsertBeforeS(Lst, LstNode, void *);
+void Lst_InsertBefore(Lst, LstNode, void *);
/* Place an element at the front of a lst. */
-void Lst_PrependS(Lst, void *);
+void Lst_Prepend(Lst, void *);
/* Place an element at the end of a lst. */
-void Lst_AppendS(Lst, void *);
+void Lst_Append(Lst, void *);
/* Remove an element */
-void Lst_RemoveS(Lst, LstNode);
+void Lst_Remove(Lst, LstNode);
/* Replace a node with a new value */
-void LstNode_SetS(LstNode, void *);
-void LstNode_SetNullS(LstNode);
+void LstNode_Set(LstNode, void *);
+void LstNode_SetNull(LstNode);
-void Lst_PrependAllS(Lst, Lst);
-void Lst_AppendAllS(Lst, Lst);
-void Lst_MoveAllS(Lst, Lst);
+void Lst_PrependAll(Lst, Lst);
+void Lst_AppendAll(Lst, Lst);
+void Lst_MoveAll(Lst, Lst);
/*
* Node-specific functions
*/
/* Return first element in list */
-LstNode Lst_FirstS(Lst);
+LstNode Lst_First(Lst);
/* Return last element in list */
-LstNode Lst_LastS(Lst);
+LstNode Lst_Last(Lst);
/* Return successor to given element */
-LstNode Lst_SuccS(LstNode);
+LstNode Lst_Succ(LstNode);
/* Return predecessor to given element */
-LstNode Lst_PrevS(LstNode);
+LstNode Lst_Prev(LstNode);
/* Get datum from LstNode */
-void *Lst_DatumS(LstNode);
+void *Lst_Datum(LstNode);
/*
* Functions for entire lists
*/
/* Find an element in a list */
-LstNode Lst_FindS(Lst, LstFindProc, const void *);
+LstNode Lst_Find(Lst, LstFindProc, const void *);
/* Find an element starting from somewhere */
-LstNode Lst_FindFromS(Lst, LstNode, LstFindProc, const void *);
+LstNode Lst_FindFrom(Lst, LstNode, LstFindProc, const void *);
/*
* See if the given datum is on the list. Returns the LstNode containing
* the datum
*/
-LstNode Lst_MemberS(Lst, void *);
+LstNode Lst_Member(Lst, void *);
/* Apply a function to all elements of a lst */
-int Lst_ForEachS(Lst, LstActionProc, void *);
+int Lst_ForEach(Lst, LstActionProc, void *);
/* Apply a function to all elements of a lst starting from a certain point. */
-int Lst_ForEachFromS(Lst, LstNode, LstActionProc, void *);
+int Lst_ForEachFrom(Lst, LstNode, LstActionProc, void *);
/*
* these functions are for dealing with a list as a table, of sorts.
* An idea of the "current element" is kept and used by all the functions
* between Lst_Open() and Lst_Close().
*/
/* Open the list */
-void Lst_OpenS(Lst);
+void Lst_Open(Lst);
/* Next element please, or NULL */
-LstNode Lst_NextS(Lst);
+LstNode Lst_Next(Lst);
/* Finish table access */
-void Lst_CloseS(Lst);
+void Lst_Close(Lst);
/*
* for using the list as a queue
*/
/* Place an element at tail of queue */
-void Lst_EnqueueS(Lst, void *);
+void Lst_Enqueue(Lst, void *);
/* Remove an element from head of queue */
-void *Lst_DequeueS(Lst);
+void *Lst_Dequeue(Lst);
#endif /* MAKE_LST_H */
Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.319 src/usr.bin/make/main.c:1.320
--- src/usr.bin/make/main.c:1.319 Fri Aug 28 04:28:45 2020
+++ src/usr.bin/make/main.c Fri Aug 28 04:48:57 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.319 2020/08/28 04:28:45 rillig Exp $ */
+/* $NetBSD: main.c,v 1.320 2020/08/28 04:48:57 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.319 2020/08/28 04:28:45 rillig Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.320 2020/08/28 04:48:57 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.319 2020/08/28 04:28:45 rillig Exp $");
+__RCSID("$NetBSD: main.c,v 1.320 2020/08/28 04:48:57 rillig Exp $");
#endif
#endif /* not lint */
#endif
@@ -541,7 +541,7 @@ rearg:
case 'v':
if (argvalue == NULL) goto noarg;
printVars = c == 'v' ? EXPAND_VARS : COMPAT_VARS;
- Lst_AppendS(variables, argvalue);
+ Lst_Append(variables, argvalue);
Var_Append(MAKEFLAGS, "-V", VAR_GLOBAL);
Var_Append(MAKEFLAGS, argvalue, VAR_GLOBAL);
break;
@@ -569,7 +569,7 @@ rearg:
break;
case 'f':
if (argvalue == NULL) goto noarg;
- Lst_AppendS(makefiles, argvalue);
+ Lst_Append(makefiles, argvalue);
break;
case 'i':
ignoreErrors = TRUE;
@@ -658,7 +658,7 @@ rearg:
Punt("illegal (null) argument.");
if (*argv[1] == '-' && !dashDash)
goto rearg;
- Lst_AppendS(create, bmake_strdup(argv[1]));
+ Lst_Append(create, bmake_strdup(argv[1]));
}
return;
@@ -808,7 +808,7 @@ str2Lst_Append(Lst lp, char *str, const
sep = " \t";
for (n = 0, cp = strtok(str, sep); cp; cp = strtok(NULL, sep)) {
- Lst_AppendS(lp, cp);
+ Lst_Append(lp, cp);
n++;
}
return n;
@@ -869,8 +869,8 @@ doPrintVars(void)
else
expandVars = getBoolean(".MAKE.EXPAND_VARIABLES", FALSE);
- for (ln = Lst_FirstS(variables); ln != NULL; ln = Lst_SuccS(ln)) {
- char *var = Lst_DatumS(ln);
+ for (ln = Lst_First(variables); ln != NULL; ln = Lst_Succ(ln)) {
+ char *var = Lst_Datum(ln);
const char *value;
char *p1;
@@ -904,7 +904,7 @@ runTargets(void)
* we consult the parsing module to find the main target(s)
* to create.
*/
- if (Lst_IsEmptyS(create))
+ if (Lst_IsEmpty(create))
targs = Parse_MainName();
else
targs = Targ_FindList(create, TARG_CREATE);
@@ -932,7 +932,7 @@ runTargets(void)
Compat_Run(targs);
outOfDate = FALSE;
}
- Lst_FreeS(targs);
+ Lst_Free(targs);
return outOfDate;
}
@@ -1275,11 +1275,11 @@ main(int argc, char **argv)
* created. If none specified, make the variable empty -- the parser
* will fill the thing in with the default or .MAIN target.
*/
- if (!Lst_IsEmptyS(create)) {
+ if (!Lst_IsEmpty(create)) {
LstNode ln;
- for (ln = Lst_FirstS(create); ln != NULL; ln = Lst_SuccS(ln)) {
- char *name = Lst_DatumS(ln);
+ for (ln = Lst_First(create); ln != NULL; ln = Lst_Succ(ln)) {
+ char *name = Lst_Datum(ln);
Var_Append(".TARGETS", name, VAR_GLOBAL);
}
} else
@@ -1325,30 +1325,30 @@ main(int argc, char **argv)
sysMkPath = Lst_Init();
Dir_Expand(_PATH_DEFSYSMK,
- Lst_IsEmptyS(sysIncPath) ? defIncPath : sysIncPath,
+ Lst_IsEmpty(sysIncPath) ? defIncPath : sysIncPath,
sysMkPath);
- if (Lst_IsEmptyS(sysMkPath))
+ if (Lst_IsEmpty(sysMkPath))
Fatal("%s: no system rules (%s).", progname,
_PATH_DEFSYSMK);
- ln = Lst_FindS(sysMkPath, ReadMakefile, NULL);
+ ln = Lst_Find(sysMkPath, ReadMakefile, NULL);
if (ln == NULL)
Fatal("%s: cannot open %s.", progname,
- (char *)Lst_DatumS(ln));
+ (char *)Lst_Datum(ln));
}
- if (!Lst_IsEmptyS(makefiles)) {
+ if (!Lst_IsEmpty(makefiles)) {
LstNode ln;
- ln = Lst_FindS(makefiles, ReadAllMakefiles, NULL);
+ ln = Lst_Find(makefiles, ReadAllMakefiles, NULL);
if (ln != NULL)
Fatal("%s: cannot open %s.", progname,
- (char *)Lst_DatumS(ln));
+ (char *)Lst_Datum(ln));
} else {
p1 = Var_Subst("${" MAKEFILE_PREFERENCE "}",
VAR_CMD, VARE_WANTRES);
if (p1) {
(void)str2Lst_Append(makefiles, p1, NULL);
- (void)Lst_FindS(makefiles, ReadMakefile, NULL);
+ (void)Lst_Find(makefiles, ReadMakefile, NULL);
free(p1);
}
}
@@ -1466,9 +1466,9 @@ main(int argc, char **argv)
}
#ifdef CLEANUP
- Lst_FreeS(variables);
- Lst_FreeS(makefiles);
- Lst_DestroyS(create, free);
+ Lst_Free(variables);
+ Lst_Free(makefiles);
+ Lst_Destroy(create, free);
#endif
/* print the graph now it's been processed if the user requested it */
@@ -1544,7 +1544,7 @@ ReadMakefile(const void *p, const void *
name = Dir_FindFile(fname, parseIncPath);
if (!name)
name = Dir_FindFile(fname,
- Lst_IsEmptyS(sysIncPath) ? defIncPath : sysIncPath);
+ Lst_IsEmpty(sysIncPath) ? defIncPath : sysIncPath);
if (!name || (fd = open(name, O_RDONLY)) == -1) {
free(name);
free(path);
@@ -2040,7 +2040,7 @@ PrintOnError(GNode *gn, const char *s)
*/
Var_Set(".ERROR_TARGET", gn->name, VAR_GLOBAL);
Var_Delete(".ERROR_CMD", VAR_GLOBAL);
- Lst_ForEachS(gn->commands, addErrorCMD, gn);
+ Lst_ForEach(gn->commands, addErrorCMD, gn);
}
expr = "${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'\n@}";
cp = Var_Subst(expr, VAR_GLOBAL, VARE_WANTRES);
Index: src/usr.bin/make/make.c
diff -u src/usr.bin/make/make.c:1.128 src/usr.bin/make/make.c:1.129
--- src/usr.bin/make/make.c:1.128 Fri Aug 28 04:14:31 2020
+++ src/usr.bin/make/make.c Fri Aug 28 04:48:57 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: make.c,v 1.128 2020/08/28 04:14:31 rillig Exp $ */
+/* $NetBSD: make.c,v 1.129 2020/08/28 04:48:57 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: make.c,v 1.128 2020/08/28 04:14:31 rillig Exp $";
+static char rcsid[] = "$NetBSD: make.c,v 1.129 2020/08/28 04:48:57 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.128 2020/08/28 04:14:31 rillig Exp $");
+__RCSID("$NetBSD: make.c,v 1.129 2020/08/28 04:48:57 rillig Exp $");
#endif
#endif /* not lint */
#endif
@@ -146,7 +146,7 @@ make_abort(GNode *gn, int line)
fprintf(debug_file, "make_abort from line %d\n", line);
Targ_PrintNode(gn, &two);
- Lst_ForEachS(toBeMade, Targ_PrintNode, &two);
+ Lst_ForEach(toBeMade, Targ_PrintNode, &two);
Targ_PrintGraph(3);
abort();
}
@@ -382,7 +382,7 @@ Make_OODate(GNode *gn)
* thinking they're out-of-date.
*/
if (!oodate) {
- Lst_ForEachS(gn->parents, MakeTimeStamp, gn);
+ Lst_ForEach(gn->parents, MakeTimeStamp, gn);
}
return oodate;
@@ -415,7 +415,7 @@ MakeAddChild(void *gnp, void *lp)
if (DEBUG(MAKE))
fprintf(debug_file, "MakeAddChild: need to examine %s%s\n",
gn->name, gn->cohort_num);
- Lst_EnqueueS(l, gn);
+ Lst_Enqueue(l, gn);
}
return 0;
}
@@ -474,19 +474,19 @@ Make_HandleUse(GNode *cgn, GNode *pgn)
}
#endif
- if ((cgn->type & (OP_USE|OP_USEBEFORE)) || Lst_IsEmptyS(pgn->commands)) {
+ if ((cgn->type & (OP_USE|OP_USEBEFORE)) || Lst_IsEmpty(pgn->commands)) {
if (cgn->type & OP_USEBEFORE) {
/* .USEBEFORE */
- Lst_PrependAllS(pgn->commands, cgn->commands);
+ Lst_PrependAll(pgn->commands, cgn->commands);
} else {
/* .USE, or target has no commands */
- Lst_AppendAllS(pgn->commands, cgn->commands);
+ Lst_AppendAll(pgn->commands, cgn->commands);
}
}
- Lst_OpenS(cgn->children);
- while ((ln = Lst_NextS(cgn->children)) != NULL) {
- GNode *gn = Lst_DatumS(ln);
+ Lst_Open(cgn->children);
+ while ((ln = Lst_Next(cgn->children)) != NULL) {
+ GNode *gn = Lst_Datum(ln);
/*
* Expand variables in the .USE node's name
@@ -507,11 +507,11 @@ Make_HandleUse(GNode *cgn, GNode *pgn)
gn = tgn;
}
- Lst_AppendS(pgn->children, gn);
- Lst_AppendS(gn->parents, pgn);
+ Lst_Append(pgn->children, gn);
+ Lst_Append(gn->parents, pgn);
pgn->unmade += 1;
}
- Lst_CloseS(cgn->children);
+ Lst_Close(cgn->children);
pgn->type |= cgn->type & ~(OP_OPMASK|OP_USE|OP_USEBEFORE|OP_TRANSFORM);
}
@@ -561,8 +561,8 @@ MakeHandleUse(void *cgnp, void *pgnp)
* children the parent has. This is used by Make_Run to decide
* whether to queue the parent or examine its children...
*/
- if ((ln = Lst_MemberS(pgn->children, cgn)) != NULL) {
- Lst_RemoveS(pgn->children, ln);
+ if ((ln = Lst_Member(pgn->children, cgn)) != NULL) {
+ Lst_Remove(pgn->children, ln);
pgn->unmade--;
}
return 0;
@@ -614,7 +614,7 @@ Make_Recheck(GNode *gn)
* To force things that depend on FRC to be made, so we have to
* check for gn->children being empty as well...
*/
- if (!Lst_IsEmptyS(gn->commands) || Lst_IsEmptyS(gn->children)) {
+ if (!Lst_IsEmpty(gn->commands) || Lst_IsEmpty(gn->children)) {
gn->mtime = now;
}
#else
@@ -724,7 +724,7 @@ Make_Update(GNode *cgn)
* which is where all parents are linked.
*/
if ((centurion = cgn->centurion) != NULL) {
- if (!Lst_IsEmptyS(cgn->parents))
+ if (!Lst_IsEmpty(cgn->parents))
Punt("%s%s: cohort has parents", cgn->name, cgn->cohort_num);
centurion->unmade_cohorts -= 1;
if (centurion->unmade_cohorts < 0)
@@ -735,12 +735,12 @@ Make_Update(GNode *cgn)
parents = centurion->parents;
/* If this was a .ORDER node, schedule the RHS */
- Lst_ForEachS(centurion->order_succ, MakeBuildParent, Lst_FirstS(toBeMade));
+ Lst_ForEach(centurion->order_succ, MakeBuildParent, Lst_First(toBeMade));
/* Now mark all the parents as having one less unmade child */
- Lst_OpenS(parents);
- while ((ln = Lst_NextS(parents)) != NULL) {
- pgn = Lst_DatumS(ln);
+ Lst_Open(parents);
+ while ((ln = Lst_Next(parents)) != NULL) {
+ pgn = Lst_Datum(ln);
if (DEBUG(MAKE))
fprintf(debug_file, "inspect parent %s%s: flags %x, "
"type %x, made %d, unmade %d ",
@@ -817,7 +817,7 @@ Make_Update(GNode *cgn)
continue;
}
assert(pgn->order_pred != NULL);
- if (Lst_ForEachS(pgn->order_pred, MakeCheckOrder, 0)) {
+ if (Lst_ForEach(pgn->order_pred, MakeCheckOrder, 0)) {
/* A .ORDER rule stops us building this */
continue;
}
@@ -830,20 +830,20 @@ Make_Update(GNode *cgn)
}
/* Ok, we can schedule the parent again */
pgn->made = REQUESTED;
- Lst_EnqueueS(toBeMade, pgn);
+ Lst_Enqueue(toBeMade, pgn);
}
- Lst_CloseS(parents);
+ Lst_Close(parents);
/*
* Set the .PREFIX and .IMPSRC variables for all the implied parents
* of this node.
*/
- Lst_OpenS(cgn->iParents);
+ Lst_Open(cgn->iParents);
{
const char *cpref = Var_Value(PREFIX, cgn, &p1);
- while ((ln = Lst_NextS(cgn->iParents)) != NULL) {
- pgn = Lst_DatumS(ln);
+ while ((ln = Lst_Next(cgn->iParents)) != NULL) {
+ pgn = Lst_Datum(ln);
if (pgn->flags & REMAKE) {
Var_Set(IMPSRC, cname, pgn);
if (cpref != NULL)
@@ -851,7 +851,7 @@ Make_Update(GNode *cgn)
}
}
bmake_free(p1);
- Lst_CloseS(cgn->iParents);
+ Lst_Close(cgn->iParents);
}
}
@@ -977,8 +977,8 @@ Make_DoAllVar(GNode *gn)
if (gn->flags & DONE_ALLSRC)
return;
- Lst_ForEachS(gn->children, MakeUnmark, gn);
- Lst_ForEachS(gn->children, MakeAddAllSrc, gn);
+ Lst_ForEach(gn->children, MakeUnmark, gn);
+ Lst_ForEach(gn->children, MakeAddAllSrc, gn);
if (!Var_Exists (OODATE, gn)) {
Var_Set(OODATE, "", gn);
@@ -1038,7 +1038,7 @@ MakeBuildChild(void *v_cn, void *toBeMad
/* If this node is on the RHS of a .ORDER, check LHSs. */
assert(cn->order_pred);
- if (Lst_ForEachS(cn->order_pred, MakeCheckOrder, 0)) {
+ if (Lst_ForEach(cn->order_pred, MakeCheckOrder, 0)) {
/* Can't build this (or anything else in this child list) yet */
cn->made = DEFERRED;
return 0; /* but keep looking */
@@ -1050,12 +1050,12 @@ MakeBuildChild(void *v_cn, void *toBeMad
cn->made = REQUESTED;
if (toBeMade_next == NULL)
- Lst_AppendS(toBeMade, cn);
+ Lst_Append(toBeMade, cn);
else
- Lst_InsertBeforeS(toBeMade, toBeMade_next, cn);
+ Lst_InsertBefore(toBeMade, toBeMade_next, cn);
if (cn->unmade_cohorts != 0)
- Lst_ForEachS(cn->cohorts, MakeBuildChild, toBeMade_next);
+ Lst_ForEach(cn->cohorts, MakeBuildChild, toBeMade_next);
/*
* If this node is a .WAIT node with unmade chlidren
@@ -1087,13 +1087,13 @@ MakeStartJobs(void)
GNode *gn;
int have_token = 0;
- while (!Lst_IsEmptyS(toBeMade)) {
+ while (!Lst_IsEmpty(toBeMade)) {
/* Get token now to avoid cycling job-list when we only have 1 token */
if (!have_token && !Job_TokenWithdraw())
break;
have_token = 1;
- gn = Lst_DequeueS(toBeMade);
+ gn = Lst_Dequeue(toBeMade);
if (DEBUG(MAKE))
fprintf(debug_file, "Examining %s%s...\n",
gn->name, gn->cohort_num);
@@ -1121,7 +1121,7 @@ MakeStartJobs(void)
* just before the current first element.
*/
gn->made = DEFERRED;
- Lst_ForEachS(gn->children, MakeBuildChild, Lst_FirstS(toBeMade));
+ Lst_ForEach(gn->children, MakeBuildChild, Lst_First(toBeMade));
/* and drop this node on the floor */
if (DEBUG(MAKE))
fprintf(debug_file, "dropped %s%s\n", gn->name, gn->cohort_num);
@@ -1237,7 +1237,7 @@ MakePrintStatus(void *gnp, void *v_error
GNode_FprintDetails(debug_file, " (", gn, ")!\n");
}
/* Most likely problem is actually caused by .ORDER */
- Lst_ForEachS(gn->order_pred, MakePrintStatusOrder, gn);
+ Lst_ForEach(gn->order_pred, MakePrintStatusOrder, gn);
break;
default:
/* Errors - already counted */
@@ -1261,7 +1261,7 @@ MakePrintStatus(void *gnp, void *v_error
if (!(gn->flags & CYCLE)) {
/* Fist time we've seen this node, check all children */
gn->flags |= CYCLE;
- Lst_ForEachS(gn->children, MakePrintStatus, errors);
+ Lst_ForEach(gn->children, MakePrintStatus, errors);
/* Mark that this node needn't be processed again */
gn->flags |= DONECYCLE;
return 0;
@@ -1275,7 +1275,7 @@ MakePrintStatus(void *gnp, void *v_error
return 1;
/* Reporting for our children will give the rest of the loop */
- Lst_ForEachS(gn->children, MakePrintStatus, errors);
+ Lst_ForEach(gn->children, MakePrintStatus, errors);
return 0;
}
@@ -1297,7 +1297,7 @@ Make_ExpandUse(Lst targs)
GNode *gn; /* a temporary pointer */
Lst examine; /* List of targets to examine */
- examine = Lst_CopyS(targs, NULL);
+ examine = Lst_Copy(targs, NULL);
/*
* Make an initial downward pass over the graph, marking nodes to be made
@@ -1307,8 +1307,8 @@ Make_ExpandUse(Lst targs)
* be looked at in a minute, otherwise we add its children to our queue
* and go on about our business.
*/
- while (!Lst_IsEmptyS(examine)) {
- gn = Lst_DequeueS(examine);
+ while (!Lst_IsEmpty(examine)) {
+ gn = Lst_Dequeue(examine);
if (gn->flags & REMAKE)
/* We've looked at this one already */
@@ -1319,7 +1319,7 @@ Make_ExpandUse(Lst targs)
gn->name, gn->cohort_num);
if (gn->type & OP_DOUBLEDEP)
- Lst_PrependAllS(examine, gn->cohorts);
+ Lst_PrependAll(examine, gn->cohorts);
/*
* Apply any .USE rules before looking for implicit dependencies
@@ -1343,24 +1343,24 @@ Make_ExpandUse(Lst targs)
(void)Dir_MTime(gn, 0);
Var_Set(TARGET, gn->path ? gn->path : gn->name, gn);
- Lst_ForEachS(gn->children, MakeUnmark, gn);
- Lst_ForEachS(gn->children, MakeHandleUse, gn);
+ Lst_ForEach(gn->children, MakeUnmark, gn);
+ Lst_ForEach(gn->children, MakeHandleUse, gn);
if ((gn->type & OP_MADE) == 0)
Suff_FindDeps(gn);
else {
/* Pretend we made all this node's children */
- Lst_ForEachS(gn->children, MakeFindChild, gn);
+ Lst_ForEach(gn->children, MakeFindChild, gn);
if (gn->unmade != 0)
printf("Warning: %s%s still has %d unmade children\n",
gn->name, gn->cohort_num, gn->unmade);
}
if (gn->unmade != 0)
- Lst_ForEachS(gn->children, MakeAddChild, examine);
+ Lst_ForEach(gn->children, MakeAddChild, examine);
}
- Lst_FreeS(examine);
+ Lst_Free(examine);
}
/*-
@@ -1380,8 +1380,8 @@ link_parent(void *cnp, void *pnp)
GNode *cn = cnp;
GNode *pn = pnp;
- Lst_AppendS(pn->children, cn);
- Lst_AppendS(cn->parents, pn);
+ Lst_Append(pn->children, cn);
+ Lst_Append(cn->parents, pn);
pn->unmade++;
return 0;
}
@@ -1403,9 +1403,9 @@ add_wait_dep(void *v_cn, void *v_wn)
fprintf(debug_file, ".WAIT: add dependency %s%s -> %s\n",
cn->name, cn->cohort_num, wn->name);
- Lst_AppendS(wn->children, cn);
+ Lst_Append(wn->children, cn);
wn->unmade++;
- Lst_AppendS(cn->parents, wn);
+ Lst_Append(cn->parents, wn);
return 0;
}
@@ -1428,18 +1428,18 @@ Make_ProcessWait(Lst targs)
pgn->flags = REMAKE;
pgn->type = OP_PHONY | OP_DEPENDS;
/* Get it displayed in the diag dumps */
- Lst_PrependS(Targ_List(), pgn);
+ Lst_Prepend(Targ_List(), pgn);
- Lst_ForEachS(targs, link_parent, pgn);
+ Lst_ForEach(targs, link_parent, pgn);
/* Start building with the 'dummy' .MAIN' node */
MakeBuildChild(pgn, NULL);
examine = Lst_Init();
- Lst_AppendS(examine, pgn);
+ Lst_Append(examine, pgn);
- while (!Lst_IsEmptyS(examine)) {
- pgn = Lst_DequeueS(examine);
+ while (!Lst_IsEmpty(examine)) {
+ pgn = Lst_Dequeue(examine);
/* We only want to process each child-list once */
if (pgn->flags & DONE_WAIT)
@@ -1449,24 +1449,24 @@ Make_ProcessWait(Lst targs)
fprintf(debug_file, "Make_ProcessWait: examine %s\n", pgn->name);
if (pgn->type & OP_DOUBLEDEP)
- Lst_PrependAllS(examine, pgn->cohorts);
+ Lst_PrependAll(examine, pgn->cohorts);
- owln = Lst_FirstS(pgn->children);
- Lst_OpenS(pgn->children);
- for (; (ln = Lst_NextS(pgn->children)) != NULL; ) {
- cgn = Lst_DatumS(ln);
+ owln = Lst_First(pgn->children);
+ Lst_Open(pgn->children);
+ for (; (ln = Lst_Next(pgn->children)) != NULL; ) {
+ cgn = Lst_Datum(ln);
if (cgn->type & OP_WAIT) {
/* Make the .WAIT node depend on the previous children */
- Lst_ForEachFromS(pgn->children, owln, add_wait_dep, cgn);
+ Lst_ForEachFrom(pgn->children, owln, add_wait_dep, cgn);
owln = ln;
} else {
- Lst_AppendS(examine, cgn);
+ Lst_Append(examine, cgn);
}
}
- Lst_CloseS(pgn->children);
+ Lst_Close(pgn->children);
}
- Lst_FreeS(examine);
+ Lst_Free(examine);
}
/*-
@@ -1536,7 +1536,7 @@ Make_Run(Lst targs)
* Note that the Job module will exit if there were any errors unless the
* keepgoing flag was given.
*/
- while (!Lst_IsEmptyS(toBeMade) || jobTokensRunning > 0) {
+ while (!Lst_IsEmpty(toBeMade) || jobTokensRunning > 0) {
Job_CatchOutput();
(void)MakeStartJobs();
}
@@ -1550,7 +1550,7 @@ Make_Run(Lst targs)
if (DEBUG(MAKE))
fprintf(debug_file, "done: errors %d\n", errors);
if (errors == 0) {
- Lst_ForEachS(targs, MakePrintStatus, &errors);
+ Lst_ForEach(targs, MakePrintStatus, &errors);
if (DEBUG(MAKE)) {
fprintf(debug_file, "done: errors %d\n", errors);
if (errors)
Index: src/usr.bin/make/meta.c
diff -u src/usr.bin/make/meta.c:1.105 src/usr.bin/make/meta.c:1.106
--- src/usr.bin/make/meta.c:1.105 Fri Aug 28 04:28:45 2020
+++ src/usr.bin/make/meta.c Fri Aug 28 04:48:57 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: meta.c,v 1.105 2020/08/28 04:28:45 rillig Exp $ */
+/* $NetBSD: meta.c,v 1.106 2020/08/28 04:48:57 rillig Exp $ */
/*
* Implement 'meta' mode.
@@ -416,7 +416,7 @@ meta_needed(GNode *gn, const char *dname
}
/* Check if there are no commands to execute. */
- if (Lst_IsEmptyS(gn->commands)) {
+ if (Lst_IsEmpty(gn->commands)) {
if (verbose)
fprintf(debug_file, "Skipping meta for %s: no commands\n",
gn->name);
@@ -424,7 +424,7 @@ meta_needed(GNode *gn, const char *dname
}
if ((gn->type & (OP_META|OP_SUBMAKE)) == OP_SUBMAKE) {
/* OP_SUBMAKE is a bit too aggressive */
- if (Lst_ForEachS(gn->commands, is_submake, gn)) {
+ if (Lst_ForEach(gn->commands, is_submake, gn)) {
if (DEBUG(META))
fprintf(debug_file, "Skipping meta for %s: .SUBMAKE\n",
gn->name);
@@ -517,7 +517,7 @@ meta_create(BuildMon *pbm, GNode *gn)
mf.gn = gn;
- Lst_ForEachS(gn->commands, printCMD, &mf);
+ Lst_ForEach(gn->commands, printCMD, &mf);
fprintf(mf.fp, "CWD %s\n", getcwd(buf, sizeof(buf)));
fprintf(mf.fp, "TARGET %s\n", tname);
@@ -890,10 +890,10 @@ void
meta_finish(void)
{
if (metaBailiwick != NULL)
- Lst_FreeS(metaBailiwick);
+ Lst_Free(metaBailiwick);
free(metaBailiwickStr);
if (metaIgnorePaths != NULL)
- Lst_FreeS(metaIgnorePaths);
+ Lst_Free(metaIgnorePaths);
free(metaIgnorePathsStr);
}
@@ -1001,7 +1001,7 @@ meta_ignore(GNode *gn, const char *p)
if (*p == '/') {
cached_realpath(p, fname); /* clean it up */
- if (Lst_ForEachS(metaIgnorePaths, prefix_match, fname)) {
+ if (Lst_ForEach(metaIgnorePaths, prefix_match, fname)) {
#ifdef DEBUG_META_MODE
if (DEBUG(META))
fprintf(debug_file, "meta_oodate: ignoring path: %s\n",
@@ -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_FirstS(gn->commands);
+ ln = Lst_First(gn->commands);
while (!oodate && (x = fgetLine(&buf, &bufsz, 0, fp)) > 0) {
lineno++;
if (buf[x - 1] == '\n')
@@ -1332,18 +1332,18 @@ meta_oodate(GNode *gn, Boolean oodate)
DEQUOTE(move_target);
/* FALLTHROUGH */
case 'D': /* unlink */
- if (*p == '/' && !Lst_IsEmptyS(missingFiles)) {
+ if (*p == '/' && !Lst_IsEmpty(missingFiles)) {
/* remove any missingFiles entries that match p */
- ln = Lst_FindS(missingFiles, path_match, p);
+ ln = Lst_Find(missingFiles, path_match, p);
if (ln != NULL) {
LstNode nln;
char *tp;
do {
- nln = Lst_FindFromS(missingFiles, Lst_SuccS(ln),
+ nln = Lst_FindFrom(missingFiles, Lst_Succ(ln),
path_match, p);
- tp = Lst_DatumS(ln);
- Lst_RemoveS(missingFiles, ln);
+ tp = Lst_Datum(ln);
+ Lst_Remove(missingFiles, ln);
free(tp);
} while ((ln = nln) != NULL);
}
@@ -1390,14 +1390,14 @@ meta_oodate(GNode *gn, Boolean oodate)
if (*p != '/')
break;
- if (Lst_IsEmptyS(metaBailiwick))
+ if (Lst_IsEmpty(metaBailiwick))
break;
/* ignore cwd - normal dependencies handle those */
if (strncmp(p, cwd, cwdlen) == 0)
break;
- if (!Lst_ForEachS(metaBailiwick, prefix_match, p))
+ if (!Lst_ForEach(metaBailiwick, prefix_match, p))
break;
/* tmpdir might be within */
@@ -1411,8 +1411,8 @@ meta_oodate(GNode *gn, Boolean oodate)
if ((link_src != NULL && cached_lstat(p, &fs) < 0) ||
(link_src == NULL && cached_stat(p, &fs) < 0)) {
if (!meta_ignore(gn, p)) {
- if (Lst_FindS(missingFiles, string_match, p) == NULL)
- Lst_AppendS(missingFiles, bmake_strdup(p));
+ if (Lst_Find(missingFiles, string_match, p) == NULL)
+ Lst_Append(missingFiles, bmake_strdup(p));
}
}
break;
@@ -1497,8 +1497,8 @@ meta_oodate(GNode *gn, Boolean oodate)
* A referenced file outside of CWD is missing.
* We cannot catch every eventuality here...
*/
- if (Lst_FindS(missingFiles, string_match, p) == NULL)
- Lst_AppendS(missingFiles, bmake_strdup(p));
+ if (Lst_Find(missingFiles, string_match, p) == NULL)
+ Lst_Append(missingFiles, bmake_strdup(p));
}
}
if (buf[0] == 'E') {
@@ -1521,7 +1521,7 @@ meta_oodate(GNode *gn, Boolean oodate)
fprintf(debug_file, "%s: %d: there were more build commands in the meta data file than there are now...\n", fname, lineno);
oodate = TRUE;
} else {
- char *cmd = Lst_DatumS(ln);
+ char *cmd = Lst_Datum(ln);
Boolean hasOODATE = FALSE;
if (strstr(cmd, "$?"))
@@ -1573,7 +1573,7 @@ meta_oodate(GNode *gn, Boolean oodate)
oodate = TRUE;
}
free(cmd);
- ln = Lst_SuccS(ln);
+ ln = Lst_Succ(ln);
}
} else if (strcmp(buf, "CWD") == 0) {
/*
@@ -1595,10 +1595,10 @@ meta_oodate(GNode *gn, Boolean oodate)
}
fclose(fp);
- if (!Lst_IsEmptyS(missingFiles)) {
+ if (!Lst_IsEmpty(missingFiles)) {
if (DEBUG(META))
fprintf(debug_file, "%s: missing files: %s...\n",
- fname, (char *)Lst_DatumS(Lst_FirstS(missingFiles)));
+ fname, (char *)Lst_Datum(Lst_First(missingFiles)));
oodate = TRUE;
}
if (!oodate && !have_filemon && filemonMissing) {
@@ -1625,7 +1625,7 @@ meta_oodate(GNode *gn, Boolean oodate)
}
}
- Lst_DestroyS(missingFiles, free);
+ Lst_Destroy(missingFiles, free);
if (oodate && needOODATE) {
/*
Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.267 src/usr.bin/make/parse.c:1.268
--- src/usr.bin/make/parse.c:1.267 Thu Aug 27 19:15:35 2020
+++ src/usr.bin/make/parse.c Fri Aug 28 04:48:57 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.267 2020/08/27 19:15:35 rillig Exp $ */
+/* $NetBSD: parse.c,v 1.268 2020/08/28 04:48:57 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: parse.c,v 1.267 2020/08/27 19:15:35 rillig Exp $";
+static char rcsid[] = "$NetBSD: parse.c,v 1.268 2020/08/28 04:48:57 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.267 2020/08/27 19:15:35 rillig Exp $");
+__RCSID("$NetBSD: parse.c,v 1.268 2020/08/28 04:48:57 rillig Exp $");
#endif
#endif /* not lint */
#endif
@@ -852,11 +852,11 @@ ParseLinkSrc(void *pgnp, void *cgnp)
GNode *pgn = (GNode *)pgnp;
GNode *cgn = (GNode *)cgnp;
- if ((pgn->type & OP_DOUBLEDEP) && !Lst_IsEmptyS(pgn->cohorts))
- pgn = Lst_DatumS(Lst_LastS(pgn->cohorts));
- Lst_AppendS(pgn->children, cgn);
+ if ((pgn->type & OP_DOUBLEDEP) && !Lst_IsEmpty(pgn->cohorts))
+ pgn = Lst_Datum(Lst_Last(pgn->cohorts));
+ Lst_Append(pgn->children, cgn);
if (specType == Not)
- Lst_AppendS(cgn->parents, pgn);
+ Lst_Append(cgn->parents, pgn);
pgn->unmade += 1;
if (DEBUG(PARSE)) {
fprintf(debug_file, "# %s: added child %s - %s\n", __func__,
@@ -932,7 +932,7 @@ ParseDoOp(void *gnp, void *opp)
* traversals will no longer see this node anyway. -mycroft)
*/
cohort->type = op | OP_INVISIBLE;
- Lst_AppendS(gn->cohorts, cohort);
+ Lst_Append(gn->cohorts, cohort);
cohort->centurion = gn;
gn->unmade_cohorts += 1;
snprintf(cohort->cohort_num, sizeof cohort->cohort_num, "#%d",
@@ -982,7 +982,7 @@ ParseDoSrc(int tOp, const char *src)
int op = parseKeywords[keywd].op;
if (op != 0) {
if (targets != NULL)
- Lst_ForEachS(targets, ParseDoOp, &op);
+ Lst_ForEach(targets, ParseDoOp, &op);
return;
}
if (parseKeywords[keywd].spec == Wait) {
@@ -1001,7 +1001,7 @@ ParseDoSrc(int tOp, const char *src)
ParseMark(gn);
gn->type = OP_WAIT | OP_PHONY | OP_DEPENDS | OP_NOTMAIN;
if (targets != NULL)
- Lst_ForEachS(targets, ParseLinkSrc, gn);
+ Lst_ForEach(targets, ParseLinkSrc, gn);
return;
}
}
@@ -1017,7 +1017,7 @@ ParseDoSrc(int tOp, const char *src)
* invoked if the user didn't specify a target on the command
* line. This is to allow #ifmake's to succeed, or something...
*/
- Lst_AppendS(create, bmake_strdup(src));
+ Lst_Append(create, bmake_strdup(src));
/*
* Add the name to the .TARGETS variable as well, so the user can
* employ that, if desired.
@@ -1034,8 +1034,8 @@ ParseDoSrc(int tOp, const char *src)
if (doing_depend)
ParseMark(gn);
if (predecessor != NULL) {
- Lst_AppendS(predecessor->order_succ, gn);
- Lst_AppendS(gn->order_pred, predecessor);
+ Lst_Append(predecessor->order_succ, gn);
+ Lst_Append(gn->order_pred, predecessor);
if (DEBUG(PARSE)) {
fprintf(debug_file, "# %s: added Order dependency %s - %s\n",
__func__, predecessor->name, gn->name);
@@ -1070,7 +1070,7 @@ ParseDoSrc(int tOp, const char *src)
gn->type |= tOp;
} else {
if (targets != NULL)
- Lst_ForEachS(targets, ParseLinkSrc, gn);
+ Lst_ForEach(targets, ParseLinkSrc, gn);
}
break;
}
@@ -1357,10 +1357,10 @@ ParseDoDependency(char *line)
if (paths == NULL) {
paths = Lst_Init();
}
- Lst_AppendS(paths, dirSearchPath);
+ Lst_Append(paths, dirSearchPath);
break;
case Main:
- if (!Lst_IsEmptyS(create)) {
+ if (!Lst_IsEmpty(create)) {
specType = Not;
}
break;
@@ -1373,12 +1373,12 @@ ParseDoDependency(char *line)
if (doing_depend)
ParseMark(gn);
gn->type |= OP_NOTMAIN|OP_SPECIAL;
- Lst_AppendS(targets, gn);
+ Lst_Append(targets, gn);
break;
case Default:
gn = Targ_NewGN(".DEFAULT");
gn->type |= (OP_NOTMAIN|OP_TRANSFORM);
- Lst_AppendS(targets, gn);
+ Lst_Append(targets, gn);
DEFAULT = gn;
break;
case DeleteOnError:
@@ -1415,7 +1415,7 @@ ParseDoDependency(char *line)
if (paths == NULL) {
paths = Lst_Init();
}
- Lst_AppendS(paths, path);
+ Lst_Append(paths, path);
}
}
}
@@ -1436,19 +1436,19 @@ ParseDoDependency(char *line)
Dir_Expand(line, emptyPath, curTargs);
- Lst_DestroyS(emptyPath, Dir_Destroy);
+ Lst_Destroy(emptyPath, Dir_Destroy);
} else {
/*
* No wildcards, but we want to avoid code duplication,
* so create a list with the word on it.
*/
- Lst_AppendS(curTargs, line);
+ Lst_Append(curTargs, line);
}
/* Apply the targets. */
- while(!Lst_IsEmptyS(curTargs)) {
- char *targName = Lst_DequeueS(curTargs);
+ while(!Lst_IsEmpty(curTargs)) {
+ char *targName = Lst_Dequeue(curTargs);
if (!Suff_IsTransform (targName)) {
gn = Targ_FindNode(targName, TARG_CREATE);
@@ -1458,7 +1458,7 @@ ParseDoDependency(char *line)
if (doing_depend)
ParseMark(gn);
- Lst_AppendS(targets, gn);
+ Lst_Append(targets, gn);
}
} else if (specType == ExPath && *line != '.' && *line != '\0') {
Parse_Error(PARSE_WARNING, "Extra target (%s) ignored", line);
@@ -1497,10 +1497,10 @@ ParseDoDependency(char *line)
/*
* Don't need the list of target names anymore...
*/
- Lst_FreeS(curTargs);
+ Lst_Free(curTargs);
curTargs = NULL;
- if (targets != NULL && !Lst_IsEmptyS(targets)) {
+ if (targets != NULL && !Lst_IsEmpty(targets)) {
switch(specType) {
default:
Parse_Error(PARSE_WARNING, "Special and mundane targets don't mix. Mundane ones ignored");
@@ -1551,7 +1551,7 @@ ParseDoDependency(char *line)
* used isn't consistent across all references.
*/
if (targets != NULL)
- Lst_ForEachS(targets, ParseDoOp, &op);
+ Lst_ForEach(targets, ParseDoOp, &op);
/*
* Onward to the sources.
@@ -1589,7 +1589,7 @@ ParseDoDependency(char *line)
break;
case ExPath:
if (paths != NULL)
- Lst_ForEachS(paths, ParseClearPath, NULL);
+ Lst_ForEach(paths, ParseClearPath, NULL);
Dir_SetPATH();
break;
#ifdef POSIX
@@ -1665,7 +1665,7 @@ ParseDoDependency(char *line)
break;
case ExPath:
if (paths != NULL)
- Lst_ForEachS(paths, ParseAddDir, line);
+ Lst_ForEach(paths, ParseAddDir, line);
break;
case Includes:
Suff_AddInclude(line);
@@ -1692,7 +1692,7 @@ ParseDoDependency(char *line)
line = cp;
}
if (paths) {
- Lst_FreeS(paths);
+ Lst_Free(paths);
paths = NULL;
}
if (specType == ExPath)
@@ -1725,11 +1725,11 @@ ParseDoDependency(char *line)
goto out;
}
- while (!Lst_IsEmptyS(sources)) {
- gn = Lst_DequeueS(sources);
+ while (!Lst_IsEmpty(sources)) {
+ gn = Lst_Dequeue(sources);
ParseDoSrc(tOp, gn->name);
}
- Lst_FreeS(sources);
+ Lst_Free(sources);
cp = line;
} else {
if (*cp) {
@@ -1753,14 +1753,14 @@ ParseDoDependency(char *line)
* the first dependency line that is actually a real target
* (i.e. isn't a .USE or .EXEC rule) to be made.
*/
- Lst_ForEachS(targets, ParseFindMain, NULL);
+ Lst_ForEach(targets, ParseFindMain, NULL);
}
out:
if (paths != NULL)
- Lst_FreeS(paths);
+ Lst_Free(paths);
if (curTargs != NULL)
- Lst_FreeS(curTargs);
+ Lst_Free(curTargs);
}
/*-
@@ -2087,19 +2087,19 @@ ParseAddCmd(void *gnp, void *cmd)
GNode *gn = (GNode *)gnp;
/* Add to last (ie current) cohort for :: targets */
- if ((gn->type & OP_DOUBLEDEP) && !Lst_IsEmptyS(gn->cohorts))
- gn = Lst_DatumS(Lst_LastS(gn->cohorts));
+ if ((gn->type & OP_DOUBLEDEP) && !Lst_IsEmpty(gn->cohorts))
+ gn = Lst_Datum(Lst_Last(gn->cohorts));
/* if target already supplied, ignore commands */
if (!(gn->type & OP_HAS_COMMANDS)) {
- Lst_AppendS(gn->commands, cmd);
+ Lst_Append(gn->commands, cmd);
if (ParseMaybeSubMake(cmd))
gn->type |= OP_SUBMAKE;
ParseMark(gn);
} else {
#ifdef notyet
/* XXX: We cannot do this until we fix the tree */
- Lst_AppendS(gn->commands, cmd);
+ Lst_Append(gn->commands, cmd);
Parse_Error(PARSE_WARNING,
"overriding commands for target \"%s\"; "
"previous commands defined at %s: %d ignored",
@@ -2139,7 +2139,7 @@ static void
ParseHasCommands(void *gnp)
{
GNode *gn = (GNode *)gnp;
- if (!Lst_IsEmptyS(gn->commands)) {
+ if (!Lst_IsEmpty(gn->commands)) {
gn->type |= OP_HAS_COMMANDS;
}
}
@@ -2262,7 +2262,7 @@ Parse_include_file(char *file, Boolean i
* Look for it on the system path
*/
fullname = Dir_FindFile(file,
- Lst_IsEmptyS(sysIncPath) ? defIncPath : sysIncPath);
+ Lst_IsEmpty(sysIncPath) ? defIncPath : sysIncPath);
}
if (fullname == NULL) {
@@ -2483,7 +2483,7 @@ Parse_SetInput(const char *name, int lin
if (curFile != NULL)
/* Save exiting file info */
- Lst_PrependS(includes, curFile);
+ Lst_Prepend(includes, curFile);
/* Allocate and fill in new structure */
curFile = bmake_malloc(sizeof *curFile);
@@ -2749,7 +2749,7 @@ ParseEOF(void)
free(curFile->P_str);
free(curFile);
- if (Lst_IsEmptyS(includes)) {
+ if (Lst_IsEmpty(includes)) {
curFile = NULL;
/* We've run out of input */
Var_Delete(".PARSEDIR", VAR_GLOBAL);
@@ -2759,7 +2759,7 @@ ParseEOF(void)
return DONE;
}
- curFile = Lst_DequeueS(includes);
+ curFile = Lst_Dequeue(includes);
if (DEBUG(PARSE))
fprintf(debug_file, "ParseEOF: returning to file %s, line %d\n",
curFile->fname, curFile->lineno);
@@ -3025,8 +3025,8 @@ ParseFinishLine(void)
{
if (inLine) {
if (targets != NULL) {
- Lst_ForEachS(targets, Suff_EndTransform, NULL);
- Lst_DestroyS(targets, ParseHasCommands);
+ Lst_ForEach(targets, Suff_EndTransform, NULL);
+ Lst_Destroy(targets, ParseHasCommands);
}
targets = NULL;
inLine = FALSE;
@@ -3139,9 +3139,9 @@ Parse_File(const char *name, int fd)
*/
if (targets) {
cp = bmake_strdup(cp);
- Lst_ForEachS(targets, ParseAddCmd, cp);
+ Lst_ForEach(targets, ParseAddCmd, cp);
#ifdef CLEANUP
- Lst_AppendS(targCmds, cp);
+ Lst_Append(targCmds, cp);
#endif
}
}
@@ -3246,7 +3246,7 @@ Parse_File(const char *name, int fd)
* Need a non-circular list for the target nodes
*/
if (targets != NULL)
- Lst_FreeS(targets);
+ Lst_Free(targets);
targets = Lst_Init();
inLine = TRUE;
@@ -3303,13 +3303,13 @@ void
Parse_End(void)
{
#ifdef CLEANUP
- Lst_DestroyS(targCmds, free);
+ Lst_Destroy(targCmds, free);
if (targets)
- Lst_FreeS(targets);
- Lst_DestroyS(defIncPath, Dir_Destroy);
- Lst_DestroyS(sysIncPath, Dir_Destroy);
- Lst_DestroyS(parseIncPath, Dir_Destroy);
- Lst_FreeS(includes); /* Should be empty now */
+ Lst_Free(targets);
+ Lst_Destroy(defIncPath, Dir_Destroy);
+ Lst_Destroy(sysIncPath, Dir_Destroy);
+ Lst_Destroy(parseIncPath, Dir_Destroy);
+ Lst_Free(includes); /* Should be empty now */
#endif
}
@@ -3339,11 +3339,11 @@ Parse_MainName(void)
Punt("no target to make.");
/*NOTREACHED*/
} else if (mainNode->type & OP_DOUBLEDEP) {
- Lst_AppendS(mainList, mainNode);
- Lst_AppendAllS(mainList, mainNode->cohorts);
+ Lst_Append(mainList, mainNode);
+ Lst_AppendAll(mainList, mainNode->cohorts);
}
else
- Lst_AppendS(mainList, mainNode);
+ Lst_Append(mainList, mainNode);
Var_Append(".TARGETS", mainNode->name, VAR_GLOBAL);
return mainList;
}
Index: src/usr.bin/make/suff.c
diff -u src/usr.bin/make/suff.c:1.124 src/usr.bin/make/suff.c:1.125
--- src/usr.bin/make/suff.c:1.124 Fri Aug 28 04:28:45 2020
+++ src/usr.bin/make/suff.c Fri Aug 28 04:48:57 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: suff.c,v 1.124 2020/08/28 04:28:45 rillig Exp $ */
+/* $NetBSD: suff.c,v 1.125 2020/08/28 04:48:57 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: suff.c,v 1.124 2020/08/28 04:28:45 rillig Exp $";
+static char rcsid[] = "$NetBSD: suff.c,v 1.125 2020/08/28 04:48:57 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.124 2020/08/28 04:28:45 rillig Exp $");
+__RCSID("$NetBSD: suff.c,v 1.125 2020/08/28 04:48:57 rillig Exp $");
#endif
#endif /* not lint */
#endif
@@ -407,9 +407,9 @@ SuffUnRef(void *lp, void *sp)
{
Lst l = (Lst) lp;
- LstNode ln = Lst_MemberS(l, sp);
+ LstNode ln = Lst_Member(l, sp);
if (ln != NULL) {
- Lst_RemoveS(l, ln);
+ Lst_Remove(l, ln);
((Suff *)sp)->refCount--;
}
}
@@ -444,10 +444,10 @@ SuffFree(void *sp)
s->refCount);
#endif
- Lst_FreeS(s->ref);
- Lst_FreeS(s->children);
- Lst_FreeS(s->parents);
- Lst_DestroyS(s->searchPath, Dir_Destroy);
+ Lst_Free(s->ref);
+ Lst_Free(s->children);
+ Lst_Free(s->parents);
+ Lst_Destroy(s->searchPath, Dir_Destroy);
free(s->name);
free(s);
@@ -499,14 +499,14 @@ SuffInsert(Lst l, Suff *s)
LstNode ln; /* current element in l we're examining */
Suff *s2 = NULL; /* the suffix descriptor in this element */
- Lst_OpenS(l);
- while ((ln = Lst_NextS(l)) != NULL) {
- s2 = Lst_DatumS(ln);
+ Lst_Open(l);
+ while ((ln = Lst_Next(l)) != NULL) {
+ s2 = Lst_Datum(ln);
if (s2->sNum >= s->sNum) {
break;
}
}
- Lst_CloseS(l);
+ Lst_Close(l);
if (DEBUG(SUFF)) {
fprintf(debug_file, "inserting %s(%d)...", s->name, s->sNum);
@@ -515,16 +515,16 @@ SuffInsert(Lst l, Suff *s)
if (DEBUG(SUFF)) {
fprintf(debug_file, "at end of list\n");
}
- Lst_AppendS(l, s);
+ Lst_Append(l, s);
s->refCount++;
- Lst_AppendS(s->ref, l);
+ Lst_Append(s->ref, l);
} else if (s2->sNum != s->sNum) {
if (DEBUG(SUFF)) {
fprintf(debug_file, "before %s(%d)\n", s2->name, s2->sNum);
}
- Lst_InsertBeforeS(l, ln, s);
+ Lst_InsertBefore(l, ln, s);
s->refCount++;
- Lst_AppendS(s->ref, l);
+ Lst_Append(s->ref, l);
} else if (DEBUG(SUFF)) {
fprintf(debug_file, "already there\n");
}
@@ -569,7 +569,7 @@ void
Suff_ClearSuffixes(void)
{
#ifdef CLEANUP
- Lst_MoveAllS(suffClean, sufflist);
+ Lst_MoveAll(suffClean, sufflist);
#endif
sufflist = Lst_Init();
sNum = 0;
@@ -622,9 +622,9 @@ SuffParseTransform(char *str, Suff **src
*/
for (;;) {
if (srcLn == NULL) {
- srcLn = Lst_FindS(sufflist, SuffSuffIsPrefix, str);
+ srcLn = Lst_Find(sufflist, SuffSuffIsPrefix, str);
} else {
- srcLn = Lst_FindFromS(sufflist, Lst_SuccS(srcLn),
+ srcLn = Lst_FindFrom(sufflist, Lst_Succ(srcLn),
SuffSuffIsPrefix, str);
}
if (srcLn == NULL) {
@@ -647,16 +647,16 @@ SuffParseTransform(char *str, Suff **src
}
return FALSE;
}
- src = Lst_DatumS(srcLn);
+ src = Lst_Datum(srcLn);
str2 = str + src->nameLen;
if (*str2 == '\0') {
single = src;
singleLn = srcLn;
} else {
- targLn = Lst_FindS(sufflist, SuffSuffHasNameP, str2);
+ targLn = Lst_Find(sufflist, SuffSuffHasNameP, str2);
if (targLn != NULL) {
*srcPtr = src;
- *targPtr = Lst_DatumS(targLn);
+ *targPtr = Lst_Datum(targLn);
return TRUE;
}
}
@@ -713,14 +713,14 @@ Suff_AddTransform(char *line)
*t; /* target suffix */
LstNode ln; /* Node for existing transformation */
- ln = Lst_FindS(transforms, SuffGNHasNameP, line);
+ ln = Lst_Find(transforms, SuffGNHasNameP, line);
if (ln == NULL) {
/*
* Make a new graph node for the transformation. It will be filled in
* by the Parse module.
*/
gn = Targ_NewGN(line);
- Lst_AppendS(transforms, gn);
+ Lst_Append(transforms, gn);
} else {
/*
* New specification for transformation rule. Just nuke the old list
@@ -728,9 +728,9 @@ Suff_AddTransform(char *line)
* free the commands themselves, because a given command can be
* attached to several different transformations.
*/
- gn = Lst_DatumS(ln);
- Lst_FreeS(gn->commands);
- Lst_FreeS(gn->children);
+ gn = Lst_Datum(ln);
+ Lst_Free(gn->commands);
+ Lst_Free(gn->children);
gn->commands = Lst_Init();
gn->children = Lst_Init();
}
@@ -778,10 +778,10 @@ Suff_EndTransform(void *gnp, void *dummy
{
GNode *gn = (GNode *)gnp;
- if ((gn->type & OP_DOUBLEDEP) && !Lst_IsEmptyS(gn->cohorts))
- gn = Lst_DatumS(Lst_LastS(gn->cohorts));
- if ((gn->type & OP_TRANSFORM) && Lst_IsEmptyS(gn->commands) &&
- Lst_IsEmptyS(gn->children))
+ if ((gn->type & OP_DOUBLEDEP) && !Lst_IsEmpty(gn->cohorts))
+ gn = Lst_Datum(Lst_Last(gn->cohorts));
+ if ((gn->type & OP_TRANSFORM) && Lst_IsEmpty(gn->commands) &&
+ Lst_IsEmpty(gn->children))
{
Suff *s, *t;
@@ -862,13 +862,13 @@ SuffRebuildGraph(void *transformp, void
*/
cp = UNCONST(SuffStrIsPrefix(s->name, transform->name));
if (cp != NULL) {
- ln = Lst_FindS(sufflist, SuffSuffHasNameP, cp);
+ ln = Lst_Find(sufflist, SuffSuffHasNameP, cp);
if (ln != NULL) {
/*
* Found target. Link in and return, since it can't be anything
* else.
*/
- s2 = Lst_DatumS(ln);
+ s2 = Lst_Datum(ln);
SuffInsert(s2->children, s);
SuffInsert(s->parents, s2);
return 0;
@@ -886,7 +886,7 @@ SuffRebuildGraph(void *transformp, void
* Null-terminate the source suffix in order to find it.
*/
cp[1] = '\0';
- ln = Lst_FindS(sufflist, SuffSuffHasNameP, transform->name);
+ ln = Lst_Find(sufflist, SuffSuffHasNameP, transform->name);
/*
* Replace the start of the target suffix
*/
@@ -895,7 +895,7 @@ SuffRebuildGraph(void *transformp, void
/*
* Found it -- establish the proper relationship
*/
- s2 = Lst_DatumS(ln);
+ s2 = Lst_Datum(ln);
SuffInsert(s->children, s2);
SuffInsert(s2->parents, s);
}
@@ -947,7 +947,7 @@ SuffScanTargets(void *targetp, void *gsp
*gs->gn = NULL;
Targ_SetMain(NULL);
}
- Lst_FreeS(target->children);
+ Lst_Free(target->children);
target->children = Lst_Init();
target->type = OP_TRANSFORM;
/*
@@ -989,11 +989,11 @@ Suff_AddSuffix(char *str, GNode **gn)
LstNode ln;
GNodeSuff gs;
- ln = Lst_FindS(sufflist, SuffSuffHasNameP, str);
+ ln = Lst_Find(sufflist, SuffSuffHasNameP, str);
if (ln == NULL) {
s = SuffNew(str);
- Lst_AppendS(sufflist, s);
+ Lst_Append(sufflist, s);
/*
* We also look at our existing targets list to see if adding
* this suffix will make one of our current targets mutate into
@@ -1003,12 +1003,12 @@ Suff_AddSuffix(char *str, GNode **gn)
gs.gn = gn;
gs.s = s;
gs.r = FALSE;
- Lst_ForEachS(Targ_List(), SuffScanTargets, &gs);
+ Lst_ForEach(Targ_List(), SuffScanTargets, &gs);
/*
* Look for any existing transformations from or to this suffix.
* XXX: Only do this after a Suff_ClearSuffixes?
*/
- Lst_ForEachS(transforms, SuffRebuildGraph, s);
+ Lst_ForEach(transforms, SuffRebuildGraph, s);
}
}
@@ -1031,11 +1031,11 @@ Suff_GetPath(char *sname)
LstNode ln;
Suff *s;
- ln = Lst_FindS(sufflist, SuffSuffHasNameP, sname);
+ ln = Lst_Find(sufflist, SuffSuffHasNameP, sname);
if (ln == NULL) {
return NULL;
} else {
- s = Lst_DatumS(ln);
+ s = Lst_Datum(ln);
return s->searchPath;
}
}
@@ -1071,10 +1071,10 @@ Suff_DoPaths(void)
inIncludes = Lst_Init();
inLibs = Lst_Init();
- Lst_OpenS(sufflist);
- while ((ln = Lst_NextS(sufflist)) != NULL) {
- s = Lst_DatumS(ln);
- if (!Lst_IsEmptyS(s->searchPath)) {
+ Lst_Open(sufflist);
+ while ((ln = Lst_Next(sufflist)) != NULL) {
+ s = Lst_Datum(ln);
+ if (!Lst_IsEmpty(s->searchPath)) {
#ifdef INCLUDES
if (s->flags & SUFF_INCLUDE) {
Dir_Concat(inIncludes, s->searchPath);
@@ -1087,19 +1087,19 @@ Suff_DoPaths(void)
#endif /* LIBRARIES */
Dir_Concat(s->searchPath, dirSearchPath);
} else {
- Lst_DestroyS(s->searchPath, Dir_Destroy);
- s->searchPath = Lst_CopyS(dirSearchPath, Dir_CopyDir);
+ Lst_Destroy(s->searchPath, Dir_Destroy);
+ s->searchPath = Lst_Copy(dirSearchPath, Dir_CopyDir);
}
}
- Lst_CloseS(sufflist);
+ Lst_Close(sufflist);
Var_Set(".INCLUDES", ptr = Dir_MakeFlags("-I", inIncludes), VAR_GLOBAL);
free(ptr);
Var_Set(".LIBS", ptr = Dir_MakeFlags("-L", inLibs), VAR_GLOBAL);
free(ptr);
- Lst_DestroyS(inIncludes, Dir_Destroy);
- Lst_DestroyS(inLibs, Dir_Destroy);
+ Lst_Destroy(inIncludes, Dir_Destroy);
+ Lst_Destroy(inLibs, Dir_Destroy);
}
/*-
@@ -1126,9 +1126,9 @@ Suff_AddInclude(char *sname)
LstNode ln;
Suff *s;
- ln = Lst_FindS(sufflist, SuffSuffHasNameP, sname);
+ ln = Lst_Find(sufflist, SuffSuffHasNameP, sname);
if (ln != NULL) {
- s = Lst_DatumS(ln);
+ s = Lst_Datum(ln);
s->flags |= SUFF_INCLUDE;
}
}
@@ -1158,9 +1158,9 @@ Suff_AddLib(char *sname)
LstNode ln;
Suff *s;
- ln = Lst_FindS(sufflist, SuffSuffHasNameP, sname);
+ ln = Lst_Find(sufflist, SuffSuffHasNameP, sname);
if (ln != NULL) {
- s = Lst_DatumS(ln);
+ s = Lst_Datum(ln);
s->flags |= SUFF_LIBRARY;
}
}
@@ -1210,12 +1210,12 @@ SuffAddSrc(void *sp, void *lsp)
s->refCount++;
s2->children = 0;
targ->children += 1;
- Lst_AppendS(ls->l, s2);
+ Lst_Append(ls->l, s2);
#ifdef DEBUG_SRC
s2->cp = Lst_Init();
- Lst_AppendS(targ->cp, s2);
+ Lst_Append(targ->cp, s2);
fprintf(debug_file, "1 add %p %p to %p:", targ, s2, ls->l);
- Lst_ForEachS(ls->l, PrintAddr, NULL);
+ Lst_ForEach(ls->l, PrintAddr, NULL);
fprintf(debug_file, "\n");
#endif
}
@@ -1228,12 +1228,12 @@ SuffAddSrc(void *sp, void *lsp)
s->refCount++;
s2->children = 0;
targ->children += 1;
- Lst_AppendS(ls->l, s2);
+ Lst_Append(ls->l, s2);
#ifdef DEBUG_SRC
s2->cp = Lst_Init();
- Lst_AppendS(targ->cp, s2);
+ Lst_Append(targ->cp, s2);
fprintf(debug_file, "2 add %p %p to %p:", targ, s2, ls->l);
- Lst_ForEachS(ls->l, PrintAddr, NULL);
+ Lst_ForEach(ls->l, PrintAddr, NULL);
fprintf(debug_file, "\n");
#endif
@@ -1264,7 +1264,7 @@ SuffAddLevel(Lst l, Src *targ)
ls.s = targ;
ls.l = l;
- Lst_ForEachS(targ->suff->children, SuffAddSrc, &ls);
+ Lst_ForEach(targ->suff->children, SuffAddSrc, &ls);
}
/*-
@@ -1286,49 +1286,49 @@ SuffRemoveSrc(Lst l)
Src *s;
int t = 0;
- Lst_OpenS(l);
+ Lst_Open(l);
#ifdef DEBUG_SRC
fprintf(debug_file, "cleaning %lx: ", (unsigned long) l);
- Lst_ForEachS(l, PrintAddr, NULL);
+ Lst_ForEach(l, PrintAddr, NULL);
fprintf(debug_file, "\n");
#endif
- while ((ln = Lst_NextS(l)) != NULL) {
- s = Lst_DatumS(ln);
+ while ((ln = Lst_Next(l)) != NULL) {
+ s = Lst_Datum(ln);
if (s->children == 0) {
free(s->file);
if (!s->parent)
free(s->pref);
else {
#ifdef DEBUG_SRC
- LstNode ln2 = Lst_MemberS(s->parent->cp, s);
+ LstNode ln2 = Lst_Member(s->parent->cp, s);
if (ln2 != NULL)
- Lst_RemoveS(s->parent->cp, ln2);
+ Lst_Remove(s->parent->cp, ln2);
#endif
--s->parent->children;
}
#ifdef DEBUG_SRC
fprintf(debug_file, "free: [l=%p] p=%p %d\n", l, s, s->children);
- Lst_FreeS(s->cp);
+ Lst_Free(s->cp);
#endif
- Lst_RemoveS(l, ln);
+ Lst_Remove(l, ln);
free(s);
t |= 1;
- Lst_CloseS(l);
+ Lst_Close(l);
return TRUE;
}
#ifdef DEBUG_SRC
else {
fprintf(debug_file, "keep: [l=%p] p=%p %d: ", l, s, s->children);
- Lst_ForEachS(s->cp, PrintAddr, NULL);
+ Lst_ForEach(s->cp, PrintAddr, NULL);
fprintf(debug_file, "\n");
}
#endif
}
- Lst_CloseS(l);
+ Lst_Close(l);
return t;
}
@@ -1357,8 +1357,8 @@ SuffFindThem(Lst srcs, Lst slst)
rs = NULL;
- while (!Lst_IsEmptyS(srcs)) {
- s = Lst_DequeueS(srcs);
+ while (!Lst_IsEmpty(srcs)) {
+ s = Lst_Dequeue(srcs);
if (DEBUG(SUFF)) {
fprintf(debug_file, "\ttrying %s...", s->file);
@@ -1390,7 +1390,7 @@ SuffFindThem(Lst srcs, Lst slst)
}
SuffAddLevel(srcs, s);
- Lst_AppendS(slst, s);
+ Lst_Append(slst, s);
}
if (DEBUG(SUFF) && rs) {
@@ -1429,18 +1429,18 @@ SuffFindCmds(Src *targ, Lst slst)
char *cp;
t = targ->node;
- Lst_OpenS(t->children);
+ Lst_Open(t->children);
prefLen = strlen(targ->pref);
for (;;) {
- ln = Lst_NextS(t->children);
+ ln = Lst_Next(t->children);
if (ln == NULL) {
- Lst_CloseS(t->children);
+ Lst_Close(t->children);
return NULL;
}
- s = Lst_DatumS(ln);
+ s = Lst_Datum(ln);
- if (s->type & OP_OPTIONAL && Lst_IsEmptyS(t->commands)) {
+ if (s->type & OP_OPTIONAL && Lst_IsEmpty(t->commands)) {
/*
* We haven't looked to see if .OPTIONAL files exist yet, so
* don't use one as the implicit source.
@@ -1463,7 +1463,7 @@ SuffFindCmds(Src *targ, Lst slst)
* The node matches the prefix ok, see if it has a known
* suffix.
*/
- ln = Lst_FindS(sufflist, SuffSuffHasNameP, &cp[prefLen]);
+ ln = Lst_Find(sufflist, SuffSuffHasNameP, &cp[prefLen]);
if (ln == NULL)
continue;
/*
@@ -1472,11 +1472,11 @@ SuffFindCmds(Src *targ, Lst slst)
*
* XXX: Handle multi-stage transformations here, too.
*/
- suff = Lst_DatumS(ln);
+ suff = Lst_Datum(ln);
/* XXX: Can targ->suff be NULL here? */
if (targ->suff != NULL &&
- Lst_MemberS(suff->parents, targ->suff) != NULL)
+ Lst_Member(suff->parents, targ->suff) != NULL)
break;
}
@@ -1498,9 +1498,9 @@ SuffFindCmds(Src *targ, Lst slst)
#ifdef DEBUG_SRC
ret->cp = Lst_Init();
fprintf(debug_file, "3 add %p %p\n", targ, ret);
- Lst_AppendS(targ->cp, ret);
+ Lst_Append(targ->cp, ret);
#endif
- Lst_AppendS(slst, ret);
+ Lst_Append(slst, ret);
if (DEBUG(SUFF)) {
fprintf(debug_file, "\tusing existing source %s\n", s->name);
}
@@ -1530,11 +1530,11 @@ SuffFindCmds(Src *targ, Lst slst)
static void
SuffExpandChildren(LstNode cln, GNode *pgn)
{
- GNode *cgn = Lst_DatumS(cln);
+ GNode *cgn = Lst_Datum(cln);
GNode *gn; /* New source 8) */
char *cp; /* Expanded value */
- if (!Lst_IsEmptyS(cgn->order_pred) || !Lst_IsEmptyS(cgn->order_succ))
+ if (!Lst_IsEmpty(cgn->order_pred) || !Lst_IsEmpty(cgn->order_succ))
/* It is all too hard to process the result of .ORDER */
return;
@@ -1591,7 +1591,7 @@ SuffExpandChildren(LstNode cln, GNode *p
*/
*cp++ = '\0';
gn = Targ_FindNode(start, TARG_CREATE);
- Lst_AppendS(members, gn);
+ Lst_Append(members, gn);
while (*cp == ' ' || *cp == '\t') {
cp++;
}
@@ -1629,7 +1629,7 @@ SuffExpandChildren(LstNode cln, GNode *p
* Stuff left over -- add it to the list too
*/
gn = Targ_FindNode(start, TARG_CREATE);
- Lst_AppendS(members, gn);
+ Lst_Append(members, gn);
}
/*
* Point cp back at the beginning again so the variable value
@@ -1641,20 +1641,20 @@ SuffExpandChildren(LstNode cln, GNode *p
/*
* Add all elements of the members list to the parent node.
*/
- while(!Lst_IsEmptyS(members)) {
- gn = Lst_DequeueS(members);
+ while(!Lst_IsEmpty(members)) {
+ gn = Lst_Dequeue(members);
if (DEBUG(SUFF)) {
fprintf(debug_file, "%s...", gn->name);
}
/* Add gn to the parents child list before the original child */
- Lst_InsertBeforeS(pgn->children, cln, gn);
- Lst_AppendS(gn->parents, pgn);
+ Lst_InsertBefore(pgn->children, cln, gn);
+ Lst_Append(gn->parents, pgn);
pgn->unmade++;
/* Expand wildcards on new node */
- SuffExpandWildcards(Lst_PrevS(cln), pgn);
+ SuffExpandWildcards(Lst_Prev(cln), pgn);
}
- Lst_FreeS(members);
+ Lst_Free(members);
/*
* Free the result
@@ -1670,14 +1670,14 @@ SuffExpandChildren(LstNode cln, GNode *p
* keep it from being processed.
*/
pgn->unmade--;
- Lst_RemoveS(pgn->children, cln);
- Lst_RemoveS(cgn->parents, Lst_MemberS(cgn->parents, pgn));
+ Lst_Remove(pgn->children, cln);
+ Lst_Remove(cgn->parents, Lst_Member(cgn->parents, pgn));
}
static void
SuffExpandWildcards(LstNode cln, GNode *pgn)
{
- GNode *cgn = Lst_DatumS(cln);
+ GNode *cgn = Lst_Datum(cln);
GNode *gn; /* New source 8) */
char *cp; /* Expanded value */
Lst explist; /* List of expansions */
@@ -1691,11 +1691,11 @@ SuffExpandWildcards(LstNode cln, GNode *
explist = Lst_Init();
Dir_Expand(cgn->name, Suff_FindPath(cgn), explist);
- while (!Lst_IsEmptyS(explist)) {
+ while (!Lst_IsEmpty(explist)) {
/*
* Fetch next expansion off the list and find its GNode
*/
- cp = Lst_DequeueS(explist);
+ cp = Lst_Dequeue(explist);
if (DEBUG(SUFF)) {
fprintf(debug_file, "%s...", cp);
@@ -1703,12 +1703,12 @@ SuffExpandWildcards(LstNode cln, GNode *
gn = Targ_FindNode(cp, TARG_CREATE);
/* Add gn to the parents child list before the original child */
- Lst_InsertBeforeS(pgn->children, cln, gn);
- Lst_AppendS(gn->parents, pgn);
+ Lst_InsertBefore(pgn->children, cln, gn);
+ Lst_Append(gn->parents, pgn);
pgn->unmade++;
}
- Lst_FreeS(explist);
+ Lst_Free(explist);
if (DEBUG(SUFF)) {
fprintf(debug_file, "\n");
@@ -1719,8 +1719,8 @@ SuffExpandWildcards(LstNode cln, GNode *
* keep it from being processed.
*/
pgn->unmade--;
- Lst_RemoveS(pgn->children, cln);
- Lst_RemoveS(cgn->parents, Lst_MemberS(cgn->parents, pgn));
+ Lst_Remove(pgn->children, cln);
+ Lst_Remove(cgn->parents, Lst_Member(cgn->parents, pgn));
}
/*-
@@ -1753,13 +1753,13 @@ Suff_FindPath(GNode* gn)
LstNode ln;
sd.len = strlen(gn->name);
sd.ename = gn->name + sd.len;
- ln = Lst_FindS(sufflist, SuffSuffIsSuffixP, &sd);
+ ln = Lst_Find(sufflist, SuffSuffIsSuffixP, &sd);
if (DEBUG(SUFF)) {
fprintf(debug_file, "Wildcard expanding \"%s\"...", gn->name);
}
if (ln != NULL)
- suff = Lst_DatumS(ln);
+ suff = Lst_Datum(ln);
/* XXX: Here we can save the suffix so we don't have to do this again */
}
@@ -1810,15 +1810,15 @@ SuffApplyTransform(GNode *tGn, GNode *sG
/*
* Form the proper links between the target and source.
*/
- Lst_AppendS(tGn->children, sGn);
- Lst_AppendS(sGn->parents, tGn);
+ Lst_Append(tGn->children, sGn);
+ Lst_Append(sGn->parents, tGn);
tGn->unmade += 1;
/*
* Locate the transformation rule itself
*/
tname = str_concat2(s->name, t->name);
- ln = Lst_FindS(transforms, SuffGNHasNameP, tname);
+ ln = Lst_Find(transforms, SuffGNHasNameP, tname);
free(tname);
if (ln == NULL) {
@@ -1830,7 +1830,7 @@ SuffApplyTransform(GNode *tGn, GNode *sG
return FALSE;
}
- gn = Lst_DatumS(ln);
+ gn = Lst_Datum(ln);
if (DEBUG(SUFF)) {
fprintf(debug_file, "\tapplying %s -> %s to \"%s\"\n", s->name, t->name, tGn->name);
@@ -1839,7 +1839,7 @@ SuffApplyTransform(GNode *tGn, GNode *sG
/*
* Record last child for expansion purposes
*/
- ln = Lst_LastS(tGn->children);
+ ln = Lst_Last(tGn->children);
/*
* Pass the buck to Make_HandleUse to apply the rule
@@ -1849,8 +1849,8 @@ SuffApplyTransform(GNode *tGn, GNode *sG
/*
* Deal with wildcards and variables in any acquired sources
*/
- for (ln = ln != NULL ? Lst_SuccS(ln) : NULL; ln != NULL; ln = nln) {
- nln = Lst_SuccS(ln);
+ for (ln = ln != NULL ? Lst_Succ(ln) : NULL; ln != NULL; ln = nln) {
+ nln = Lst_Succ(ln);
SuffExpandChildren(ln, tGn);
}
@@ -1858,7 +1858,7 @@ SuffApplyTransform(GNode *tGn, GNode *sG
* Keep track of another parent to which this beast is transformed so
* the .IMPSRC variable can be set correctly for the parent.
*/
- Lst_AppendS(sGn->iParents, tGn);
+ Lst_Append(sGn->iParents, tGn);
return TRUE;
}
@@ -1922,8 +1922,8 @@ SuffFindArchiveDeps(GNode *gn, Lst slst)
/*
* Create the link between the two nodes right off
*/
- Lst_AppendS(gn->children, mem);
- Lst_AppendS(mem->parents, gn);
+ Lst_Append(gn->children, mem);
+ Lst_Append(mem->parents, gn);
gn->unmade += 1;
/*
@@ -1964,8 +1964,8 @@ SuffFindArchiveDeps(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_FirstS(gn->children); ln != NULL; ln = nln) {
- nln = Lst_SuccS(ln);
+ for (ln = Lst_First(gn->children); ln != NULL; ln = nln) {
+ nln = Lst_Succ(ln);
SuffExpandChildren(ln, gn);
}
@@ -1983,17 +1983,17 @@ SuffFindArchiveDeps(GNode *gn, Lst slst)
*/
sd.len = eoarch - gn->name;
sd.ename = eoarch;
- ln = Lst_FindS(ms->parents, SuffSuffIsSuffixP, &sd);
+ ln = Lst_Find(ms->parents, SuffSuffIsSuffixP, &sd);
if (ln != NULL) {
/*
* Got one -- apply it
*/
- if (!SuffApplyTransform(gn, mem, (Suff *)Lst_DatumS(ln), ms) &&
+ if (!SuffApplyTransform(gn, mem, (Suff *)Lst_Datum(ln), ms) &&
DEBUG(SUFF))
{
fprintf(debug_file, "\tNo transformation from %s -> %s\n",
- ms->name, ((Suff *)Lst_DatumS(ln))->name);
+ ms->name, ((Suff *)Lst_Datum(ln))->name);
}
}
}
@@ -2062,7 +2062,7 @@ SuffFindNormalDeps(GNode *gn, Lst slst)
/*
* Begin at the beginning...
*/
- ln = Lst_FirstS(sufflist);
+ ln = Lst_First(sufflist);
srcs = Lst_Init();
targs = Lst_Init();
@@ -2093,7 +2093,7 @@ SuffFindNormalDeps(GNode *gn, Lst slst)
/*
* Look for next possible suffix...
*/
- ln = Lst_FindFromS(sufflist, ln, SuffSuffIsSuffixP, &sd);
+ ln = Lst_FindFrom(sufflist, ln, SuffSuffIsSuffixP, &sd);
if (ln != NULL) {
int prefLen; /* Length of the prefix */
@@ -2103,7 +2103,7 @@ SuffFindNormalDeps(GNode *gn, Lst slst)
*/
targ = bmake_malloc(sizeof(Src));
targ->file = bmake_strdup(gn->name);
- targ->suff = Lst_DatumS(ln);
+ targ->suff = Lst_Datum(ln);
targ->suff->refCount++;
targ->node = gn;
targ->parent = NULL;
@@ -2130,19 +2130,19 @@ SuffFindNormalDeps(GNode *gn, Lst slst)
/*
* Record the target so we can nuke it
*/
- Lst_AppendS(targs, targ);
+ Lst_Append(targs, targ);
/*
* Search from this suffix's successor...
*/
- ln = Lst_SuccS(ln);
+ ln = Lst_Succ(ln);
}
}
/*
* Handle target of unknown suffix...
*/
- if (Lst_IsEmptyS(targs) && suffNull != NULL) {
+ if (Lst_IsEmpty(targs) && suffNull != NULL) {
if (DEBUG(SUFF)) {
fprintf(debug_file, "\tNo known suffix on %s. Using .NULL suffix\n", gn->name);
}
@@ -2165,7 +2165,7 @@ SuffFindNormalDeps(GNode *gn, Lst slst)
* not define suffix rules if the gnode had children but we
* don't do this anymore.
*/
- if (Lst_IsEmptyS(gn->commands))
+ if (Lst_IsEmpty(gn->commands))
SuffAddLevel(srcs, targ);
else {
if (DEBUG(SUFF))
@@ -2175,7 +2175,7 @@ SuffFindNormalDeps(GNode *gn, Lst slst)
if (DEBUG(SUFF))
fprintf(debug_file, "adding suffix rules\n");
- Lst_AppendS(targs, targ);
+ Lst_Append(targs, targ);
}
/*
@@ -2189,8 +2189,8 @@ SuffFindNormalDeps(GNode *gn, Lst slst)
* No known transformations -- use the first suffix found
* for setting the local variables.
*/
- if (!Lst_IsEmptyS(targs)) {
- targ = Lst_DatumS(Lst_FirstS(targs));
+ if (!Lst_IsEmpty(targs)) {
+ targ = Lst_Datum(Lst_First(targs));
} else {
targ = NULL;
}
@@ -2213,8 +2213,8 @@ 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_FirstS(gn->children); ln != NULL; ln = nln) {
- nln = Lst_SuccS(ln);
+ for (ln = Lst_First(gn->children); ln != NULL; ln = nln) {
+ nln = Lst_Succ(ln);
SuffExpandChildren(ln, gn);
}
@@ -2296,7 +2296,7 @@ sfnd_abort:
/*
* Check for overriding transformation rule implied by sources
*/
- if (!Lst_IsEmptyS(gn->children)) {
+ if (!Lst_IsEmpty(gn->children)) {
src = SuffFindCmds(targ, slst);
if (src != NULL) {
@@ -2305,8 +2305,8 @@ sfnd_abort:
* up to, but not including, the parent node.
*/
while (bottom && bottom->parent != NULL) {
- if (Lst_MemberS(slst, bottom) == NULL) {
- Lst_AppendS(slst, bottom);
+ if (Lst_Member(slst, bottom) == NULL) {
+ Lst_Append(slst, bottom);
}
bottom = bottom->parent;
}
@@ -2381,14 +2381,14 @@ sfnd_abort:
*/
sfnd_return:
if (bottom)
- if (Lst_MemberS(slst, bottom) == NULL)
- Lst_AppendS(slst, bottom);
+ if (Lst_Member(slst, bottom) == NULL)
+ Lst_Append(slst, bottom);
while (SuffRemoveSrc(srcs) || SuffRemoveSrc(targs))
continue;
- Lst_MoveAllS(slst, srcs);
- Lst_MoveAllS(slst, targs);
+ Lst_MoveAll(slst, srcs);
+ Lst_MoveAll(slst, targs);
}
@@ -2470,11 +2470,11 @@ SuffFindDeps(GNode *gn, Lst slst)
LstNode ln;
Suff *s;
- ln = Lst_FindS(sufflist, SuffSuffHasNameP, LIBSUFF);
+ ln = Lst_Find(sufflist, SuffSuffHasNameP, LIBSUFF);
if (gn->suffix)
gn->suffix->refCount--;
if (ln != NULL) {
- gn->suffix = s = Lst_DatumS(ln);
+ gn->suffix = s = Lst_Datum(ln);
gn->suffix->refCount++;
Arch_FindLib(gn, s->searchPath);
} else {
@@ -2518,9 +2518,9 @@ Suff_SetNull(char *name)
Suff *s;
LstNode ln;
- ln = Lst_FindS(sufflist, SuffSuffHasNameP, name);
+ ln = Lst_Find(sufflist, SuffSuffHasNameP, name);
if (ln != NULL) {
- s = Lst_DatumS(ln);
+ s = Lst_Datum(ln);
if (suffNull != NULL) {
suffNull->flags &= ~SUFF_NULL;
}
@@ -2583,12 +2583,12 @@ void
Suff_End(void)
{
#ifdef CLEANUP
- Lst_DestroyS(sufflist, SuffFree);
- Lst_DestroyS(suffClean, SuffFree);
+ Lst_Destroy(sufflist, SuffFree);
+ Lst_Destroy(suffClean, SuffFree);
if (suffNull)
SuffFree(suffNull);
- Lst_FreeS(srclist);
- Lst_FreeS(transforms);
+ Lst_Free(srclist);
+ Lst_Free(transforms);
#endif
}
@@ -2618,10 +2618,10 @@ SuffPrintSuff(void *sp, void *dummy MAKE
}
fputc('\n', debug_file);
fprintf(debug_file, "#\tTo: ");
- Lst_ForEachS(s->parents, SuffPrintName, NULL);
+ Lst_ForEach(s->parents, SuffPrintName, NULL);
fputc('\n', debug_file);
fprintf(debug_file, "#\tFrom: ");
- Lst_ForEachS(s->children, SuffPrintName, NULL);
+ Lst_ForEach(s->children, SuffPrintName, NULL);
fputc('\n', debug_file);
fprintf(debug_file, "#\tSearch Path: ");
Dir_PrintPath(s->searchPath);
@@ -2637,7 +2637,7 @@ SuffPrintTrans(void *tp, void *dummy MAK
fprintf(debug_file, "%-16s: ", t->name);
Targ_PrintType(t->type);
fputc('\n', debug_file);
- Lst_ForEachS(t->commands, Targ_PrintCmd, NULL);
+ Lst_ForEach(t->commands, Targ_PrintCmd, NULL);
fputc('\n', debug_file);
return 0;
}
@@ -2646,8 +2646,8 @@ void
Suff_PrintAll(void)
{
fprintf(debug_file, "#*** Suffixes:\n");
- Lst_ForEachS(sufflist, SuffPrintSuff, NULL);
+ Lst_ForEach(sufflist, SuffPrintSuff, NULL);
fprintf(debug_file, "#*** Transformations:\n");
- Lst_ForEachS(transforms, SuffPrintTrans, NULL);
+ Lst_ForEach(transforms, SuffPrintTrans, NULL);
}
Index: src/usr.bin/make/targ.c
diff -u src/usr.bin/make/targ.c:1.75 src/usr.bin/make/targ.c:1.76
--- src/usr.bin/make/targ.c:1.75 Thu Aug 27 19:15:35 2020
+++ src/usr.bin/make/targ.c Fri Aug 28 04:48:57 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: targ.c,v 1.75 2020/08/27 19:15:35 rillig Exp $ */
+/* $NetBSD: targ.c,v 1.76 2020/08/28 04:48:57 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: targ.c,v 1.75 2020/08/27 19:15:35 rillig Exp $";
+static char rcsid[] = "$NetBSD: targ.c,v 1.76 2020/08/28 04:48:57 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)targ.c 8.2 (Berkeley) 3/19/94";
#else
-__RCSID("$NetBSD: targ.c,v 1.75 2020/08/27 19:15:35 rillig Exp $");
+__RCSID("$NetBSD: targ.c,v 1.76 2020/08/28 04:48:57 rillig Exp $");
#endif
#endif /* not lint */
#endif
@@ -188,9 +188,9 @@ Targ_End(void)
{
Targ_Stats();
#ifdef CLEANUP
- Lst_FreeS(allTargets);
+ Lst_Free(allTargets);
if (allGNs != NULL)
- Lst_DestroyS(allGNs, TargFreeGN);
+ Lst_Destroy(allGNs, TargFreeGN);
Hash_DeleteTable(&targets);
#endif
}
@@ -273,7 +273,7 @@ Targ_NewGN(const char *name)
#ifdef CLEANUP
if (allGNs == NULL)
allGNs = Lst_Init();
- Lst_AppendS(allGNs, gn);
+ Lst_Append(allGNs, gn);
#endif
return gn;
@@ -303,14 +303,14 @@ TargFreeGN(void *gnp)
free(gn->path);
/* gn->fname points to name allocated when file was opened, don't free */
- Lst_FreeS(gn->iParents);
- Lst_FreeS(gn->cohorts);
- Lst_FreeS(gn->parents);
- Lst_FreeS(gn->children);
- Lst_FreeS(gn->order_succ);
- Lst_FreeS(gn->order_pred);
+ Lst_Free(gn->iParents);
+ Lst_Free(gn->cohorts);
+ Lst_Free(gn->parents);
+ Lst_Free(gn->children);
+ Lst_Free(gn->order_succ);
+ Lst_Free(gn->order_pred);
Hash_DeleteTable(&gn->context);
- Lst_FreeS(gn->commands);
+ Lst_Free(gn->commands);
free(gn);
}
#endif
@@ -360,7 +360,7 @@ Targ_FindNode(const char *name, int flag
if (!(flags & TARG_NOHASH))
Hash_SetValue(he, gn);
Var_Append(".ALLTARGETS", name, VAR_GLOBAL);
- Lst_AppendS(allTargets, gn);
+ Lst_Append(allTargets, gn);
if (doing_depend)
gn->flags |= FROM_DEPEND;
return gn;
@@ -395,9 +395,9 @@ Targ_FindList(Lst names, int flags)
nodes = Lst_Init();
- Lst_OpenS(names);
- while ((ln = Lst_NextS(names)) != NULL) {
- name = Lst_DatumS(ln);
+ Lst_Open(names);
+ while ((ln = Lst_Next(names)) != NULL) {
+ name = Lst_Datum(ln);
gn = Targ_FindNode(name, flags);
if (gn != NULL) {
/*
@@ -405,12 +405,12 @@ Targ_FindList(Lst names, int flags)
* are added to the list in the order in which they were
* encountered in the makefile.
*/
- Lst_AppendS(nodes, gn);
+ Lst_Append(nodes, gn);
} else if (flags == TARG_NOCREATE) {
Error("\"%s\" -- target unknown.", name);
}
}
- Lst_CloseS(names);
+ Lst_Close(names);
return nodes;
}
@@ -660,28 +660,28 @@ Targ_PrintNode(void *gnp, void *passp)
fprintf(debug_file, "# unmade\n");
}
}
- if (!Lst_IsEmptyS(gn->iParents)) {
+ if (!Lst_IsEmpty(gn->iParents)) {
fprintf(debug_file, "# implicit parents: ");
- Lst_ForEachS(gn->iParents, TargPrintName, NULL);
+ Lst_ForEach(gn->iParents, TargPrintName, NULL);
fprintf(debug_file, "\n");
}
} else {
if (gn->unmade)
fprintf(debug_file, "# %d unmade children\n", gn->unmade);
}
- if (!Lst_IsEmptyS(gn->parents)) {
+ if (!Lst_IsEmpty(gn->parents)) {
fprintf(debug_file, "# parents: ");
- Lst_ForEachS(gn->parents, TargPrintName, NULL);
+ Lst_ForEach(gn->parents, TargPrintName, NULL);
fprintf(debug_file, "\n");
}
- if (!Lst_IsEmptyS(gn->order_pred)) {
+ if (!Lst_IsEmpty(gn->order_pred)) {
fprintf(debug_file, "# order_pred: ");
- Lst_ForEachS(gn->order_pred, TargPrintName, NULL);
+ Lst_ForEach(gn->order_pred, TargPrintName, NULL);
fprintf(debug_file, "\n");
}
- if (!Lst_IsEmptyS(gn->order_succ)) {
+ if (!Lst_IsEmpty(gn->order_succ)) {
fprintf(debug_file, "# order_succ: ");
- Lst_ForEachS(gn->order_succ, TargPrintName, NULL);
+ Lst_ForEach(gn->order_succ, TargPrintName, NULL);
fprintf(debug_file, "\n");
}
@@ -695,12 +695,12 @@ Targ_PrintNode(void *gnp, void *passp)
fprintf(debug_file, ":: "); break;
}
Targ_PrintType(gn->type);
- Lst_ForEachS(gn->children, TargPrintName, NULL);
+ Lst_ForEach(gn->children, TargPrintName, NULL);
fprintf(debug_file, "\n");
- Lst_ForEachS(gn->commands, Targ_PrintCmd, NULL);
+ Lst_ForEach(gn->commands, Targ_PrintCmd, NULL);
fprintf(debug_file, "\n\n");
if (gn->type & OP_DOUBLEDEP) {
- Lst_ForEachS(gn->cohorts, Targ_PrintNode, &pass);
+ Lst_ForEach(gn->cohorts, Targ_PrintNode, &pass);
}
}
return 0;
@@ -754,10 +754,10 @@ void
Targ_PrintGraph(int pass)
{
fprintf(debug_file, "#*** Input graph:\n");
- Lst_ForEachS(allTargets, Targ_PrintNode, &pass);
+ Lst_ForEach(allTargets, Targ_PrintNode, &pass);
fprintf(debug_file, "\n\n");
fprintf(debug_file, "#\n# Files that are only sources:\n");
- Lst_ForEachS(allTargets, TargPrintOnlySrc, NULL);
+ Lst_ForEach(allTargets, TargPrintOnlySrc, NULL);
fprintf(debug_file, "#*** Global Variables:\n");
Var_Dump(VAR_GLOBAL);
fprintf(debug_file, "#*** Command-line Variables:\n");
@@ -798,7 +798,7 @@ TargPropagateNode(void *gnp, void *junk
GNode *gn = (GNode *)gnp;
if (gn->type & OP_DOUBLEDEP)
- Lst_ForEachS(gn->cohorts, TargPropagateCohort, gnp);
+ Lst_ForEach(gn->cohorts, TargPropagateCohort, gnp);
return 0;
}
@@ -847,5 +847,5 @@ TargPropagateCohort(void *cgnp, void *pg
void
Targ_Propagate(void)
{
- Lst_ForEachS(allTargets, TargPropagateNode, NULL);
+ Lst_ForEach(allTargets, TargPropagateNode, NULL);
}