Module Name: src
Committed By: rillig
Date: Tue Sep 22 04:05:41 UTC 2020
Modified Files:
src/usr.bin/make: arch.c compat.c dir.c dir.h lst.c lst.h main.c make.c
make.h meta.c nonints.h parse.c suff.c targ.c var.c
Log Message:
make(1): use fine-grained type names for lists and their nodes
This is only intended to help the human reader. There is no additional
type safety yet.
To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/usr.bin/make/arch.c
cvs rdiff -u -r1.146 -r1.147 src/usr.bin/make/compat.c
cvs rdiff -u -r1.143 -r1.144 src/usr.bin/make/dir.c src/usr.bin/make/make.h
cvs rdiff -u -r1.24 -r1.25 src/usr.bin/make/dir.h
cvs rdiff -u -r1.64 -r1.65 src/usr.bin/make/lst.c
cvs rdiff -u -r1.61 -r1.62 src/usr.bin/make/lst.h
cvs rdiff -u -r1.337 -r1.338 src/usr.bin/make/main.c
cvs rdiff -u -r1.136 -r1.137 src/usr.bin/make/make.c
cvs rdiff -u -r1.115 -r1.116 src/usr.bin/make/meta.c
cvs rdiff -u -r1.123 -r1.124 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.321 -r1.322 src/usr.bin/make/parse.c
cvs rdiff -u -r1.156 -r1.157 src/usr.bin/make/suff.c
cvs rdiff -u -r1.88 -r1.89 src/usr.bin/make/targ.c
cvs rdiff -u -r1.523 -r1.524 src/usr.bin/make/var.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.116 src/usr.bin/make/arch.c:1.117
--- src/usr.bin/make/arch.c:1.116 Mon Sep 21 03:12:25 2020
+++ src/usr.bin/make/arch.c Tue Sep 22 04:05:41 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: arch.c,v 1.116 2020/09/21 03:12:25 rillig Exp $ */
+/* $NetBSD: arch.c,v 1.117 2020/09/22 04:05:41 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -133,7 +133,7 @@
#include "config.h"
/* "@(#)arch.c 8.2 (Berkeley) 1/2/94" */
-MAKE_RCSID("$NetBSD: arch.c,v 1.116 2020/09/21 03:12:25 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.117 2020/09/22 04:05:41 rillig Exp $");
#ifdef TARGET_MACHINE
#undef MAKE_MACHINE
@@ -144,7 +144,10 @@ MAKE_RCSID("$NetBSD: arch.c,v 1.116 2020
#define MAKE_MACHINE_ARCH TARGET_MACHINE_ARCH
#endif
-static Lst archives; /* Lst of archives we've already examined */
+typedef struct List ArchList;
+typedef struct ListNode ArchListNode;
+
+static ArchList *archives; /* The archives we've already examined */
typedef struct Arch {
char *name; /* Name of archive */
@@ -203,7 +206,7 @@ ArchFree(void *ap)
*-----------------------------------------------------------------------
*/
Boolean
-Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode *ctxt)
+Arch_ParseArchive(char **linePtr, GNodeList *nodeLst, GNode *ctxt)
{
char *cp; /* Pointer into line */
GNode *gn; /* New node */
@@ -361,7 +364,7 @@ Arch_ParseArchive(char **linePtr, Lst no
*/
free(buf);
} else if (Dir_HasWildcards(memName)) {
- Lst members = Lst_Init();
+ StringList *members = Lst_Init();
Dir_Expand(memName, dirSearchPath, members);
while (!Lst_IsEmpty(members)) {
@@ -466,7 +469,7 @@ ArchStatMember(const char *archive, cons
FILE * arch; /* Stream to archive */
size_t size; /* Size of archive member */
char magic[SARMAG];
- LstNode ln; /* Lst member containing archive descriptor */
+ ArchListNode *ln;
Arch *ar; /* Archive descriptor */
Hash_Entry *he; /* Entry containing member's description */
struct ar_hdr arh; /* archive-member header for reading archive */
@@ -1019,7 +1022,7 @@ Arch_MTime(GNode *gn)
time_t
Arch_MemMTime(GNode *gn)
{
- LstNode ln;
+ GNodeListNode *ln;
GNode *pgn;
Lst_Open(gn->parents);
@@ -1073,7 +1076,7 @@ Arch_MemMTime(GNode *gn)
* path Search path
*/
void
-Arch_FindLib(GNode *gn, Lst path)
+Arch_FindLib(GNode *gn, SearchPath *path)
{
char *libName; /* file name for archive */
size_t sz = strlen(gn->name) + 6 - 2;
Index: src/usr.bin/make/compat.c
diff -u src/usr.bin/make/compat.c:1.146 src/usr.bin/make/compat.c:1.147
--- src/usr.bin/make/compat.c:1.146 Mon Sep 21 17:44:25 2020
+++ src/usr.bin/make/compat.c Tue Sep 22 04:05:41 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: compat.c,v 1.146 2020/09/21 17:44:25 rillig Exp $ */
+/* $NetBSD: compat.c,v 1.147 2020/09/22 04:05:41 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -99,7 +99,7 @@
#include "pathnames.h"
/* "@(#)compat.c 8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: compat.c,v 1.146 2020/09/21 17:44:25 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.147 2020/09/22 04:05:41 rillig Exp $");
static GNode *curTarg = NULL;
static GNode *ENDNode;
@@ -660,7 +660,7 @@ cohorts:
* targs The target nodes to re-create
*/
void
-Compat_Run(Lst targs)
+Compat_Run(GNodeList *targs)
{
GNode *gn = NULL;/* Current root target */
int errors; /* Number of targets not remade due to errors */
Index: src/usr.bin/make/dir.c
diff -u src/usr.bin/make/dir.c:1.143 src/usr.bin/make/dir.c:1.144
--- src/usr.bin/make/dir.c:1.143 Tue Sep 22 02:26:22 2020
+++ src/usr.bin/make/dir.c Tue Sep 22 04:05:41 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: dir.c,v 1.143 2020/09/22 02:26:22 rillig Exp $ */
+/* $NetBSD: dir.c,v 1.144 2020/09/22 04:05:41 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -134,7 +134,7 @@
#include "job.h"
/* "@(#)dir.c 8.2 (Berkeley) 1/2/94" */
-MAKE_RCSID("$NetBSD: dir.c,v 1.143 2020/09/22 02:26:22 rillig Exp $");
+MAKE_RCSID("$NetBSD: dir.c,v 1.144 2020/09/22 04:05:41 rillig Exp $");
#define DIR_DEBUG0(fmt) \
if (!DEBUG(DIR)) (void) 0; else fprintf(debug_file, fmt)
@@ -216,9 +216,14 @@ MAKE_RCSID("$NetBSD: dir.c,v 1.143 2020/
* in a cache for when Dir_MTime was actually called.
*/
-Lst dirSearchPath; /* main search path */
+typedef List CachedDirList;
+typedef ListNode CachedDirListNode;
-static Lst openDirectories; /* the list of all open directories */
+typedef ListNode SearchPathNode;
+
+SearchPath *dirSearchPath; /* main search path */
+
+static CachedDirList *openDirectories; /* the list of all open directories */
/*
* Variables for gathering statistics on the efficiency of the hashing
@@ -245,7 +250,7 @@ static Hash_Table mtimes;
static Hash_Table lmtimes; /* same as mtimes but for lstat */
-static void DirExpandInt(const char *, Lst, Lst);
+static void DirExpandInt(const char *, SearchPath *, StringList *);
static int DirPrintWord(void *, void *);
static int DirPrintDir(void *, void *);
static char *DirLookup(CachedDir *, const char *, const char *, Boolean);
@@ -395,7 +400,7 @@ void
Dir_InitDot(void)
{
if (dot != NULL) {
- LstNode ln;
+ CachedDirListNode *ln;
/* Remove old entry from openDirectories, but do not destroy. */
ln = Lst_FindDatum(openDirectories, dot);
@@ -446,7 +451,7 @@ Dir_End(void)
void
Dir_SetPATH(void)
{
- LstNode ln; /* a list element */
+ CachedDirListNode *ln;
Boolean hasLastDot = FALSE; /* true if we should search dot last */
Var_Delete(".PATH", VAR_GLOBAL);
@@ -562,7 +567,7 @@ Dir_HasWildcards(const char *name)
*-----------------------------------------------------------------------
*/
static void
-DirMatchFiles(const char *pattern, CachedDir *dir, Lst expansions)
+DirMatchFiles(const char *pattern, CachedDir *dir, StringList *expansions)
{
Hash_Search search; /* Index into the directory's table */
Hash_Entry *entry; /* Current entry in the table */
@@ -678,7 +683,8 @@ concat3(const char *a, size_t a_len, con
*-----------------------------------------------------------------------
*/
static void
-DirExpandCurly(const char *word, const char *brace, Lst path, Lst expansions)
+DirExpandCurly(const char *word, const char *brace, SearchPath *path,
+ StringList *expansions)
{
const char *prefix, *middle, *piece, *middle_end, *suffix;
size_t prefix_len, suffix_len;
@@ -740,9 +746,9 @@ DirExpandCurly(const char *word, const c
*-----------------------------------------------------------------------
*/
static void
-DirExpandInt(const char *word, Lst path, Lst expansions)
+DirExpandInt(const char *word, SearchPath *path, StringList *expansions)
{
- LstNode ln; /* Current node */
+ SearchPathNode *ln;
Lst_Open(path);
while ((ln = Lst_Next(path)) != NULL) {
@@ -784,7 +790,7 @@ DirPrintWord(void *word, void *dummy MAK
*-----------------------------------------------------------------------
*/
void
-Dir_Expand(const char *word, Lst path, Lst expansions)
+Dir_Expand(const char *word, SearchPath *path, StringList *expansions)
{
const char *cp;
@@ -1053,13 +1059,13 @@ DirFindDot(Boolean hasSlash MAKE_ATTR_UN
*-----------------------------------------------------------------------
*/
char *
-Dir_FindFile(const char *name, Lst path)
+Dir_FindFile(const char *name, SearchPath *path)
{
- LstNode ln; /* a list element */
+ SearchPathNode *ln;
char *file; /* the current filename to check */
- CachedDir *dir; /* current path member */
+ CachedDir *dir;
const char *base; /* Terminal name of file */
- Boolean hasLastDot = FALSE; /* true we should search dot last */
+ Boolean hasLastDot = FALSE; /* true if we should search dot last */
Boolean hasSlash; /* true if 'name' contains a / */
struct make_stat mst; /* Buffer for stat, if necessary */
const char *trailing_dot = ".";
@@ -1501,12 +1507,12 @@ Dir_MTime(GNode *gn, Boolean recheck)
*-----------------------------------------------------------------------
*/
CachedDir *
-Dir_AddDir(Lst path, const char *name)
+Dir_AddDir(SearchPath *path, const char *name)
{
- LstNode ln = NULL; /* node in case CachedDir structure is found */
+ SearchPathNode *ln = NULL;
CachedDir *dir = NULL; /* the added directory */
- DIR *d; /* for reading directory */
- struct dirent *dp; /* entry in directory */
+ DIR *d;
+ struct dirent *dp;
if (path != NULL && strcmp(name, ".DOTLAST") == 0) {
ln = Lst_Find(path, DirFindName, name);
@@ -1600,10 +1606,10 @@ Dir_CopyDir(void *p)
*-----------------------------------------------------------------------
*/
char *
-Dir_MakeFlags(const char *flag, Lst path)
+Dir_MakeFlags(const char *flag, SearchPath *path)
{
Buffer buf;
- LstNode ln; /* the node of the current directory */
+ SearchPathNode *ln;
Buf_Init(&buf, 0);
@@ -1646,7 +1652,7 @@ Dir_Destroy(void *dirp)
dir->refCount -= 1;
if (dir->refCount == 0) {
- LstNode node;
+ CachedDirListNode *node;
node = Lst_FindDatum(openDirectories, dir);
if (node != NULL)
@@ -1676,7 +1682,7 @@ Dir_Destroy(void *dirp)
*-----------------------------------------------------------------------
*/
void
-Dir_ClearPath(Lst path)
+Dir_ClearPath(SearchPath *path)
{
while (!Lst_IsEmpty(path)) {
CachedDir *dir = Lst_Dequeue(path);
@@ -1704,9 +1710,9 @@ Dir_ClearPath(Lst path)
*-----------------------------------------------------------------------
*/
void
-Dir_Concat(Lst path1, Lst path2)
+Dir_Concat(SearchPath *path1, SearchPath *path2)
{
- LstNode ln;
+ SearchPathNode *ln;
CachedDir *dir;
for (ln = Lst_First(path2); ln != NULL; ln = LstNode_Next(ln)) {
@@ -1728,7 +1734,7 @@ percentage(int num, int den)
void
Dir_PrintDirectories(void)
{
- LstNode ln;
+ CachedDirListNode *ln;
fprintf(debug_file, "#*** Directory Cache:\n");
fprintf(debug_file,
@@ -1755,7 +1761,7 @@ DirPrintDir(void *p, void *dummy MAKE_AT
}
void
-Dir_PrintPath(Lst path)
+Dir_PrintPath(SearchPath *path)
{
Lst_ForEach(path, DirPrintDir, NULL);
}
Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.143 src/usr.bin/make/make.h:1.144
--- src/usr.bin/make/make.h:1.143 Mon Sep 21 17:44:25 2020
+++ src/usr.bin/make/make.h Tue Sep 22 04:05:41 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: make.h,v 1.143 2020/09/21 17:44:25 rillig Exp $ */
+/* $NetBSD: make.h,v 1.144 2020/09/22 04:05:41 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -274,9 +274,12 @@ typedef enum {
typedef struct List StringList;
typedef struct ListNode StringListNode;
+
typedef struct List GNodeList;
typedef struct ListNode GNodeListNode;
+typedef struct List /* of CachedDir */ SearchPath;
+
/* A graph node represents a target that can possibly be made, including its
* relation to other targets and a lot of other details. */
typedef struct GNode {
@@ -412,10 +415,10 @@ typedef enum {
/*
* Global Variables
*/
-extern Lst create; /* The list of target names specified on the
+extern StringList *create; /* The list of target names specified on the
* command line. used to resolve #if
* make(...) statements */
-extern Lst dirSearchPath; /* The list of directories to search when
+extern SearchPath *dirSearchPath; /* The list of directories to search when
* looking for targets */
extern Boolean compatMake; /* True if we are make compatible */
@@ -463,8 +466,8 @@ extern time_t now; /* The time at
extern Boolean oldVars; /* Do old-style variable substitution */
-extern Lst sysIncPath; /* The system include path. */
-extern Lst defIncPath; /* The default include path. */
+extern SearchPath *sysIncPath; /* The system include path. */
+extern SearchPath *defIncPath; /* The default include path. */
extern char curdir[]; /* Startup directory */
extern char *progname; /* The program name */
@@ -532,18 +535,18 @@ extern int debug;
int Make_TimeStamp(GNode *, GNode *);
Boolean Make_OODate(GNode *);
-void Make_ExpandUse(Lst);
+void Make_ExpandUse(GNodeList *);
time_t Make_Recheck(GNode *);
void Make_HandleUse(GNode *, GNode *);
void Make_Update(GNode *);
void Make_DoAllVar(GNode *);
-Boolean Make_Run(Lst);
+Boolean Make_Run(GNodeList *);
int dieQuietly(GNode *, int);
void PrintOnError(GNode *, const char *);
void Main_ExportMAKEFLAGS(Boolean);
Boolean Main_SetObjdir(const char *, ...) MAKE_ATTR_PRINTFLIKE(1, 2);
int mkTempFile(const char *, char **);
-int str2Lst_Append(Lst, char *, const char *);
+int str2Lst_Append(StringList *, char *, const char *);
void GNode_FprintDetails(FILE *, const char *, const GNode *, const char *);
#ifdef __GNUC__
Index: src/usr.bin/make/dir.h
diff -u src/usr.bin/make/dir.h:1.24 src/usr.bin/make/dir.h:1.25
--- src/usr.bin/make/dir.h:1.24 Tue Sep 22 02:26:22 2020
+++ src/usr.bin/make/dir.h Tue Sep 22 04:05:41 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: dir.h,v 1.24 2020/09/22 02:26:22 rillig Exp $ */
+/* $NetBSD: dir.h,v 1.25 2020/09/22 04:05:41 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -97,16 +97,16 @@ void Dir_InitDot(void);
void Dir_End(void);
void Dir_SetPATH(void);
Boolean Dir_HasWildcards(const char *);
-void Dir_Expand(const char *, Lst, Lst);
-char *Dir_FindFile(const char *, Lst);
+void Dir_Expand(const char *, SearchPath *, StringList *);
+char *Dir_FindFile(const char *, SearchPath *);
Boolean Dir_FindHereOrAbove(const char *, const char *, char *, int);
int Dir_MTime(GNode *, Boolean);
-CachedDir *Dir_AddDir(Lst, const char *);
-char *Dir_MakeFlags(const char *, Lst);
-void Dir_ClearPath(Lst);
-void Dir_Concat(Lst, Lst);
+CachedDir *Dir_AddDir(SearchPath *, const char *);
+char *Dir_MakeFlags(const char *, SearchPath *);
+void Dir_ClearPath(SearchPath *);
+void Dir_Concat(SearchPath *, SearchPath *);
void Dir_PrintDirectories(void);
-void Dir_PrintPath(Lst);
+void Dir_PrintPath(SearchPath *);
void Dir_Destroy(void *);
void *Dir_CopyDir(void *);
Index: src/usr.bin/make/lst.c
diff -u src/usr.bin/make/lst.c:1.64 src/usr.bin/make/lst.c:1.65
--- src/usr.bin/make/lst.c:1.64 Mon Sep 14 19:14:19 2020
+++ src/usr.bin/make/lst.c Tue Sep 22 04:05:41 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.c,v 1.64 2020/09/14 19:14:19 rillig Exp $ */
+/* $NetBSD: lst.c,v 1.65 2020/09/22 04:05:41 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -36,7 +36,7 @@
#include "make.h"
-MAKE_RCSID("$NetBSD: lst.c,v 1.64 2020/09/14 19:14:19 rillig Exp $");
+MAKE_RCSID("$NetBSD: lst.c,v 1.65 2020/09/22 04:05:41 rillig Exp $");
struct ListNode {
struct ListNode *prev; /* previous element in list */
@@ -57,25 +57,25 @@ typedef enum {
} Where;
struct List {
- LstNode first; /* first node in list */
- LstNode last; /* last node in list */
+ ListNode *first; /* first node in list */
+ ListNode *last; /* last node in list */
/* fields for sequential access */
Boolean isOpen; /* true if list has been Lst_Open'ed */
Where lastAccess; /* Where in the list the last access was */
- LstNode curr; /* current node, if open. NULL if
+ ListNode *curr; /* current node, if open. NULL if
* *just* opened */
- LstNode prev; /* Previous node, if open. Used by Lst_Remove */
+ ListNode *prev; /* Previous node, if open. Used by Lst_Remove */
};
/* Allocate and initialize a list node.
*
* The fields 'prev' and 'next' must be initialized by the caller.
*/
-static LstNode
+static ListNode *
LstNodeNew(void *datum)
{
- LstNode node = bmake_malloc(sizeof *node);
+ ListNode *node = bmake_malloc(sizeof *node);
node->useCount = 0;
node->deleted = FALSE;
node->datum = datum;
@@ -83,16 +83,16 @@ LstNodeNew(void *datum)
}
static Boolean
-LstIsEmpty(Lst list)
+LstIsEmpty(List *list)
{
return list->first == NULL;
}
/* Create and initialize a new, empty list. */
-Lst
+List *
Lst_Init(void)
{
- Lst list = bmake_malloc(sizeof *list);
+ List *list = bmake_malloc(sizeof *list);
list->first = NULL;
list->last = NULL;
@@ -105,11 +105,11 @@ Lst_Init(void)
/* Duplicate an entire list, usually by copying the datum pointers.
* 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_Copy(Lst list, LstCopyProc copyProc)
+List *
+Lst_Copy(List *list, LstCopyProc copyProc)
{
- Lst newList;
- LstNode node;
+ List *newList;
+ ListNode *node;
assert(list != NULL);
@@ -125,10 +125,10 @@ Lst_Copy(Lst list, LstCopyProc copyProc)
/* Free a list and all its nodes. The list data itself are not freed though. */
void
-Lst_Free(Lst list)
+Lst_Free(List *list)
{
- LstNode node;
- LstNode next;
+ ListNode *node;
+ ListNode *next;
assert(list != NULL);
@@ -143,10 +143,10 @@ Lst_Free(Lst list)
/* Destroy a list and free all its resources. The freeProc is called with the
* datum from each node in turn before the node is freed. */
void
-Lst_Destroy(Lst list, LstFreeProc freeProc)
+Lst_Destroy(List *list, LstFreeProc freeProc)
{
- LstNode node;
- LstNode next;
+ ListNode *node;
+ ListNode *next;
assert(list != NULL);
assert(freeProc != NULL);
@@ -167,9 +167,9 @@ Lst_Destroy(Lst list, LstFreeProc freePr
/* Insert a new node with the given piece of data before the given node in the
* given list. */
void
-Lst_InsertBefore(Lst list, LstNode node, void *datum)
+Lst_InsertBefore(List *list, ListNode *node, void *datum)
{
- LstNode newNode;
+ ListNode *newNode;
assert(list != NULL);
assert(!LstIsEmpty(list));
@@ -192,9 +192,9 @@ Lst_InsertBefore(Lst list, LstNode node,
/* Add a piece of data at the start of the given list. */
void
-Lst_Prepend(Lst list, void *datum)
+Lst_Prepend(List *list, void *datum)
{
- LstNode node;
+ ListNode *node;
assert(list != NULL);
assert(datum != NULL);
@@ -214,9 +214,9 @@ Lst_Prepend(Lst list, void *datum)
/* Add a piece of data at the end of the given list. */
void
-Lst_Append(Lst list, void *datum)
+Lst_Append(List *list, void *datum)
{
- LstNode node;
+ ListNode *node;
assert(list != NULL);
assert(datum != NULL);
@@ -237,7 +237,7 @@ Lst_Append(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_Remove(Lst list, LstNode node)
+Lst_Remove(List *list, ListNode *node)
{
assert(list != NULL);
assert(node != NULL);
@@ -289,7 +289,7 @@ Lst_Remove(Lst list, LstNode node)
/* Replace the datum in the given node with the new datum. */
void
-LstNode_Set(LstNode node, void *datum)
+LstNode_Set(ListNode *node, void *datum)
{
assert(node != NULL);
assert(datum != NULL);
@@ -299,7 +299,7 @@ LstNode_Set(LstNode node, void *datum)
/* Replace the datum in the given node to NULL. */
void
-LstNode_SetNull(LstNode node)
+LstNode_SetNull(ListNode *node)
{
assert(node != NULL);
@@ -312,8 +312,8 @@ LstNode_SetNull(LstNode node)
*/
/* Return the first node from the given list, or NULL if the list is empty. */
-LstNode
-Lst_First(Lst list)
+ListNode *
+Lst_First(List *list)
{
assert(list != NULL);
@@ -321,8 +321,8 @@ Lst_First(Lst list)
}
/* Return the last node from the given list, or NULL if the list is empty. */
-LstNode
-Lst_Last(Lst list)
+ListNode *
+Lst_Last(List *list)
{
assert(list != NULL);
@@ -330,8 +330,8 @@ Lst_Last(Lst list)
}
/* Return the successor to the given node on its list, or NULL. */
-LstNode
-LstNode_Next(LstNode node)
+ListNode *
+LstNode_Next(ListNode *node)
{
assert(node != NULL);
@@ -339,8 +339,8 @@ LstNode_Next(LstNode node)
}
/* Return the predecessor to the given node on its list, or NULL. */
-LstNode
-LstNode_Prev(LstNode node)
+ListNode *
+LstNode_Prev(ListNode *node)
{
assert(node != NULL);
return node->prev;
@@ -348,7 +348,7 @@ LstNode_Prev(LstNode node)
/* Return the datum stored in the given node. */
void *
-LstNode_Datum(LstNode node)
+LstNode_Datum(ListNode *node)
{
assert(node != NULL);
return node->datum;
@@ -361,7 +361,7 @@ LstNode_Datum(LstNode node)
/* Return TRUE if the given list is empty. */
Boolean
-Lst_IsEmpty(Lst list)
+Lst_IsEmpty(List *list)
{
assert(list != NULL);
@@ -370,8 +370,8 @@ Lst_IsEmpty(Lst list)
/* Return the first node from the list for which the match function returns
* TRUE, or NULL if none of the nodes matched. */
-LstNode
-Lst_Find(Lst list, LstFindProc match, const void *matchArgs)
+ListNode *
+Lst_Find(List *list, LstFindProc match, const void *matchArgs)
{
return Lst_FindFrom(list, Lst_First(list), match, matchArgs);
}
@@ -381,10 +381,10 @@ Lst_Find(Lst list, LstFindProc match, co
*
* The start node may be NULL, in which case nothing is found. This allows
* for passing Lst_First or LstNode_Next as the start node. */
-LstNode
-Lst_FindFrom(Lst list, LstNode node, LstFindProc match, const void *matchArgs)
+ListNode *
+Lst_FindFrom(List *list, ListNode *node, LstFindProc match, const void *matchArgs)
{
- LstNode tln;
+ ListNode *tln;
assert(list != NULL);
assert(match != NULL);
@@ -398,10 +398,10 @@ Lst_FindFrom(Lst list, LstNode node, Lst
}
/* Return the first node that contains the given datum, or NULL. */
-LstNode
-Lst_FindDatum(Lst list, const void *datum)
+ListNode *
+Lst_FindDatum(List *list, const void *datum)
{
- LstNode node;
+ ListNode *node;
assert(list != NULL);
assert(datum != NULL);
@@ -419,7 +419,7 @@ Lst_FindDatum(Lst list, const void *datu
* should return 0 if traversal should continue and non-zero if it should
* abort. */
int
-Lst_ForEach(Lst list, LstActionProc proc, void *procData)
+Lst_ForEach(List *list, LstActionProc proc, void *procData)
{
if (LstIsEmpty(list))
return 0; /* XXX: Document what this value means. */
@@ -430,11 +430,11 @@ Lst_ForEach(Lst list, LstActionProc proc
* the given node. The function should return 0 if traversal should continue,
* and non-zero if it should abort. */
int
-Lst_ForEachFrom(Lst list, LstNode node,
+Lst_ForEachFrom(List *list, ListNode *node,
LstActionProc proc, void *procData)
{
- LstNode tln = node;
- LstNode next;
+ ListNode *tln = node;
+ ListNode *next;
Boolean done;
int result;
@@ -484,7 +484,7 @@ Lst_ForEachFrom(Lst list, LstNode node,
/* Move all nodes from list2 to the end of list1.
* List2 is destroyed and freed. */
void
-Lst_MoveAll(Lst list1, Lst list2)
+Lst_MoveAll(List *list1, List *list2)
{
assert(list1 != NULL);
assert(list2 != NULL);
@@ -503,18 +503,18 @@ Lst_MoveAll(Lst list1, Lst list2)
/* Copy the element data from src to the start of dst. */
void
-Lst_PrependAll(Lst dst, Lst src)
+Lst_PrependAll(List *dst, List *src)
{
- LstNode node;
+ ListNode *node;
for (node = src->last; node != NULL; node = node->prev)
Lst_Prepend(dst, node->datum);
}
/* Copy the element data from src to the end of dst. */
void
-Lst_AppendAll(Lst dst, Lst src)
+Lst_AppendAll(List *dst, List *src)
{
- LstNode node;
+ ListNode *node;
for (node = src->first; node != NULL; node = node->next)
Lst_Append(dst, node->datum);
}
@@ -532,7 +532,7 @@ Lst_AppendAll(Lst dst, Lst src)
/* Open a list for sequential access. A list can still be searched, etc.,
* without confusing these functions. */
void
-Lst_Open(Lst list)
+Lst_Open(List *list)
{
assert(list != NULL);
assert(!list->isOpen);
@@ -544,10 +544,10 @@ Lst_Open(Lst list)
/* Return the next node for the given list, or NULL if the end has been
* reached. */
-LstNode
-Lst_Next(Lst list)
+ListNode *
+Lst_Next(List *list)
{
- LstNode node;
+ ListNode *node;
assert(list != NULL);
assert(list->isOpen);
@@ -589,7 +589,7 @@ Lst_Next(Lst list)
/* Close a list which was opened for sequential access. */
void
-Lst_Close(Lst list)
+Lst_Close(List *list)
{
assert(list != NULL);
assert(list->isOpen);
@@ -605,14 +605,14 @@ Lst_Close(Lst list)
/* Add the datum to the tail of the given list. */
void
-Lst_Enqueue(Lst list, void *datum)
+Lst_Enqueue(List *list, void *datum)
{
Lst_Append(list, datum);
}
/* Remove and return the datum at the head of the given list. */
void *
-Lst_Dequeue(Lst list)
+Lst_Dequeue(List *list)
{
void *datum;
Index: src/usr.bin/make/lst.h
diff -u src/usr.bin/make/lst.h:1.61 src/usr.bin/make/lst.h:1.62
--- src/usr.bin/make/lst.h:1.61 Fri Sep 4 17:59:36 2020
+++ src/usr.bin/make/lst.h Tue Sep 22 04:05:41 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.h,v 1.61 2020/09/04 17:59:36 rillig Exp $ */
+/* $NetBSD: lst.h,v 1.62 2020/09/22 04:05:41 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -82,9 +82,9 @@
#include <stdlib.h>
/* A doubly-linked list of pointers. */
-typedef struct List *Lst;
+typedef struct List List;
/* A single node in the doubly-linked list. */
-typedef struct ListNode *LstNode;
+typedef struct ListNode ListNode;
/* Copy a node, usually by allocating a copy of the given object.
* For reference-counted objects, the original object may need to be
@@ -100,81 +100,81 @@ typedef int LstActionProc(void *datum, v
/* Create or destroy a list */
/* Create a new list. */
-Lst Lst_Init(void);
+List *Lst_Init(void);
/* Duplicate an existing list. */
-Lst Lst_Copy(Lst, LstCopyProc);
+List *Lst_Copy(List *, LstCopyProc);
/* Free the list, leaving the node data unmodified. */
-void Lst_Free(Lst);
+void Lst_Free(List *);
/* Free the list, freeing the node data using the given function. */
-void Lst_Destroy(Lst, LstFreeProc);
+void Lst_Destroy(List *, LstFreeProc);
/* Get information about a list */
-Boolean Lst_IsEmpty(Lst);
+Boolean Lst_IsEmpty(List *);
/* Return the first node of the list, or NULL. */
-LstNode Lst_First(Lst);
+ListNode *Lst_First(List *);
/* Return the last node of the list, or NULL. */
-LstNode Lst_Last(Lst);
+ListNode *Lst_Last(List *);
/* Find the first node for which the function returns TRUE, or NULL. */
-LstNode Lst_Find(Lst, LstFindProc, const void *);
+ListNode *Lst_Find(List *, LstFindProc, const void *);
/* Find the first node for which the function returns TRUE, or NULL.
* The search starts at the given node, towards the end of the list. */
-LstNode Lst_FindFrom(Lst, LstNode, LstFindProc, const void *);
+ListNode *Lst_FindFrom(List *, ListNode *, LstFindProc, const void *);
/* Find the first node that contains the given datum, or NULL. */
-LstNode Lst_FindDatum(Lst, const void *);
+ListNode *Lst_FindDatum(List *, const void *);
/* Modify a list */
/* Insert a datum before the given node. */
-void Lst_InsertBefore(Lst, LstNode, void *);
+void Lst_InsertBefore(List *, ListNode *, void *);
/* Place a datum at the front of the list. */
-void Lst_Prepend(Lst, void *);
+void Lst_Prepend(List *, void *);
/* Place a datum at the end of the list. */
-void Lst_Append(Lst, void *);
+void Lst_Append(List *, void *);
/* Remove the node from the list. */
-void Lst_Remove(Lst, LstNode);
-void Lst_PrependAll(Lst, Lst);
-void Lst_AppendAll(Lst, Lst);
-void Lst_MoveAll(Lst, Lst);
+void Lst_Remove(List *, ListNode *);
+void Lst_PrependAll(List *, List *);
+void Lst_AppendAll(List *, List *);
+void Lst_MoveAll(List *, List *);
/* Node-specific functions */
/* Return the successor of the node, or NULL. */
-LstNode LstNode_Next(LstNode);
+ListNode *LstNode_Next(ListNode *);
/* Return the predecessor of the node, or NULL. */
-LstNode LstNode_Prev(LstNode);
+ListNode *LstNode_Prev(ListNode *);
/* Return the datum of the node. Usually not NULL. */
-void *LstNode_Datum(LstNode);
+void *LstNode_Datum(ListNode *);
/* Replace the value of the node. */
-void LstNode_Set(LstNode, void *);
+void LstNode_Set(ListNode *, void *);
/* Set the value of the node to NULL. Having NULL in a list is unusual. */
-void LstNode_SetNull(LstNode);
+void LstNode_SetNull(ListNode *);
/* Iterating over a list, using a callback function */
/* Apply a function to each datum of the list, until the callback function
* returns non-zero. */
-int Lst_ForEach(Lst, LstActionProc, void *);
+int Lst_ForEach(List *, LstActionProc, void *);
/* Apply a function to each datum of the list, starting at the node,
* until the callback function returns non-zero. */
-int Lst_ForEachFrom(Lst, LstNode, LstActionProc, void *);
+int Lst_ForEachFrom(List *, ListNode *, LstActionProc, void *);
/* Iterating over a list while keeping track of the current node and possible
* concurrent modifications */
/* Start iterating the list. */
-void Lst_Open(Lst);
+void Lst_Open(List *);
/* Return the next node, or NULL. */
-LstNode Lst_Next(Lst);
+ListNode *Lst_Next(List *);
/* Finish iterating the list. */
-void Lst_Close(Lst);
+void Lst_Close(List *);
/* Using the list as a queue */
/* Add a datum at the tail of the queue. */
-void Lst_Enqueue(Lst, void *);
+void Lst_Enqueue(List *, void *);
/* Remove the head node of the queue and return its datum. */
-void *Lst_Dequeue(Lst);
+void *Lst_Dequeue(List *);
/* A stack is a very simple collection of items that only allows access to the
* top-most item. */
Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.337 src/usr.bin/make/main.c:1.338
--- src/usr.bin/make/main.c:1.337 Sun Sep 13 15:15:51 2020
+++ src/usr.bin/make/main.c Tue Sep 22 04:05:41 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.337 2020/09/13 15:15:51 rillig Exp $ */
+/* $NetBSD: main.c,v 1.338 2020/09/22 04:05:41 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -126,7 +126,7 @@
#endif
/* "@(#)main.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: main.c,v 1.337 2020/09/13 15:15:51 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.338 2020/09/22 04:05:41 rillig Exp $");
#if defined(MAKE_NATIVE) && !defined(lint)
__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\
The Regents of the University of California. All rights reserved.");
@@ -136,18 +136,18 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
#define DEFMAXLOCAL DEFMAXJOBS
#endif
-Lst create; /* Targets to be made */
+GNodeList * create; /* Targets to be made */
time_t now; /* Time at start of make */
GNode *DEFAULT; /* .DEFAULT node */
Boolean allPrecious; /* .PRECIOUS given on line by itself */
Boolean deleteOnError; /* .DELETE_ON_ERROR: set */
static Boolean noBuiltins; /* -r flag */
-static Lst makefiles; /* ordered list of makefiles to read */
+static StringList * makefiles; /* ordered list of makefiles to read */
static int printVars; /* -[vV] argument */
#define COMPAT_VARS 1
#define EXPAND_VARS 2
-static Lst variables; /* list of variables to print
+static StringList * variables; /* list of variables to print
* (for -v and -V) */
int maxJobs; /* -j argument */
static int maxJobTokens; /* -j argument */
@@ -188,7 +188,7 @@ FILE *debug_file;
Boolean forceJobs = FALSE;
-extern Lst parseIncPath;
+extern SearchPath *parseIncPath;
/*
* For compatibility with the POSIX version of MAKEFLAGS that includes
@@ -789,7 +789,7 @@ ReadMakefileFailed(const void *fname, co
}
int
-str2Lst_Append(Lst lp, char *str, const char *sep)
+str2Lst_Append(StringList *lp, char *str, const char *sep)
{
char *cp;
int n;
@@ -849,7 +849,7 @@ MakeMode(const char *mode)
static void
doPrintVars(void)
{
- LstNode ln;
+ StringListNode *ln;
Boolean expandVars;
if (printVars == EXPAND_VARS)
@@ -885,7 +885,7 @@ doPrintVars(void)
static Boolean
runTargets(void)
{
- Lst targs; /* target nodes to create -- passed to Make_Init */
+ GNodeList *targs; /* target nodes to create -- passed to Make_Init */
Boolean outOfDate; /* FALSE if all targets up to date */
/*
@@ -953,7 +953,7 @@ main(int argc, char **argv)
const char *machine = getenv("MACHINE");
const char *machine_arch = getenv("MACHINE_ARCH");
char *syspath = getenv("MAKESYSPATH");
- Lst sysMkPath; /* Path of sys.mk */
+ StringList *sysMkPath; /* Path of sys.mk */
char *cp = NULL, *start;
/* avoid faults on read-only strings */
static char defsyspath[] = _PATH_DEFSYSPATH;
@@ -1266,7 +1266,7 @@ main(int argc, char **argv)
* will fill the thing in with the default or .MAIN target.
*/
if (!Lst_IsEmpty(create)) {
- LstNode ln;
+ StringListNode *ln;
for (ln = Lst_First(create); ln != NULL; ln = LstNode_Next(ln)) {
char *name = LstNode_Datum(ln);
@@ -1312,7 +1312,7 @@ main(int argc, char **argv)
* if no makefiles were given on the command line.
*/
if (!noBuiltins) {
- LstNode ln;
+ StringListNode *ln;
sysMkPath = Lst_Init();
Dir_Expand(_PATH_DEFSYSMK,
@@ -1328,7 +1328,7 @@ main(int argc, char **argv)
}
if (!Lst_IsEmpty(makefiles)) {
- LstNode ln;
+ StringListNode *ln;
ln = Lst_Find(makefiles, ReadMakefileFailed, NULL);
if (ln != NULL)
Index: src/usr.bin/make/make.c
diff -u src/usr.bin/make/make.c:1.136 src/usr.bin/make/make.c:1.137
--- src/usr.bin/make/make.c:1.136 Sun Sep 13 15:15:51 2020
+++ src/usr.bin/make/make.c Tue Sep 22 04:05:41 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: make.c,v 1.136 2020/09/13 15:15:51 rillig Exp $ */
+/* $NetBSD: make.c,v 1.137 2020/09/22 04:05:41 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -107,10 +107,10 @@
#include "job.h"
/* "@(#)make.c 8.1 (Berkeley) 6/6/93" */
-MAKE_RCSID("$NetBSD: make.c,v 1.136 2020/09/13 15:15:51 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.137 2020/09/22 04:05:41 rillig Exp $");
static unsigned int checked = 1;/* Sequence # to detect recursion */
-static Lst toBeMade; /* The current fringe of the graph. These
+static GNodeList *toBeMade; /* The current fringe of the graph. These
* are nodes which await examination by
* MakeOODate. It is added to by
* Make_Update and subtracted from by
@@ -395,8 +395,8 @@ Make_OODate(GNode *gn)
static int
MakeAddChild(void *gnp, void *lp)
{
- GNode *gn = (GNode *)gnp;
- Lst l = (Lst) lp;
+ GNode *gn = gnp;
+ GNodeList *l = lp;
if ((gn->flags & REMAKE) == 0 && !(gn->type & (OP_USE|OP_USEBEFORE))) {
if (DEBUG(MAKE))
@@ -452,7 +452,7 @@ MakeFindChild(void *gnp, void *pgnp)
void
Make_HandleUse(GNode *cgn, GNode *pgn)
{
- LstNode ln; /* An element in the children list */
+ GNodeListNode *ln; /* An element in the children list */
#ifdef DEBUG_SRC
if ((cgn->type & (OP_USE|OP_USEBEFORE|OP_TRANSFORM)) == 0) {
@@ -529,7 +529,7 @@ MakeHandleUse(void *cgnp, void *pgnp)
{
GNode *cgn = (GNode *)cgnp;
GNode *pgn = (GNode *)pgnp;
- LstNode ln; /* An element in the children list */
+ GNodeListNode *ln;
int unmarked;
unmarked = ((cgn->type & OP_MARK) == 0);
@@ -682,10 +682,10 @@ Make_Update(GNode *cgn)
{
GNode *pgn; /* the parent node */
const char *cname; /* the child's name */
- LstNode ln; /* Element in parents and implicitParents lists */
+ GNodeListNode *ln;
time_t mtime = -1;
char *p1;
- Lst parents;
+ GNodeList *parents;
GNode *centurion;
/* It is save to re-examine any nodes again */
@@ -1278,10 +1278,9 @@ MakePrintStatus(void *gnp, void *v_error
*-----------------------------------------------------------------------
*/
void
-Make_ExpandUse(Lst targs)
+Make_ExpandUse(GNodeList *targs)
{
- GNode *gn; /* a temporary pointer */
- Lst examine; /* List of targets to examine */
+ GNodeList *examine; /* List of targets to examine */
examine = Lst_Copy(targs, NULL);
@@ -1294,7 +1293,7 @@ Make_ExpandUse(Lst targs)
* and go on about our business.
*/
while (!Lst_IsEmpty(examine)) {
- gn = Lst_Dequeue(examine);
+ GNode *gn = Lst_Dequeue(examine);
if (gn->flags & REMAKE)
/* We've looked at this one already */
@@ -1396,13 +1395,13 @@ add_wait_dep(void *v_cn, void *v_wn)
}
static void
-Make_ProcessWait(Lst targs)
+Make_ProcessWait(GNodeList *targs)
{
- GNode *pgn; /* 'parent' node we are examining */
- GNode *cgn; /* Each child in turn */
- LstNode owln; /* Previous .WAIT node */
- Lst examine; /* List of targets to examine */
- LstNode ln;
+ GNode *pgn; /* 'parent' node we are examining */
+ GNode *cgn; /* Each child in turn */
+ GNodeListNode *owln; /* Previous .WAIT node */
+ GNodeList *examine; /* List of targets to examine */
+ GNodeListNode *ln;
/*
* We need all the nodes to have a common parent in order for the
@@ -1480,7 +1479,7 @@ Make_ProcessWait(Lst targs)
*-----------------------------------------------------------------------
*/
Boolean
-Make_Run(Lst targs)
+Make_Run(GNodeList *targs)
{
int errors; /* Number of errors the Job module reports */
Index: src/usr.bin/make/meta.c
diff -u src/usr.bin/make/meta.c:1.115 src/usr.bin/make/meta.c:1.116
--- src/usr.bin/make/meta.c:1.115 Mon Sep 21 17:44:25 2020
+++ src/usr.bin/make/meta.c Tue Sep 22 04:05:41 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: meta.c,v 1.115 2020/09/21 17:44:25 rillig Exp $ */
+/* $NetBSD: meta.c,v 1.116 2020/09/22 04:05:41 rillig Exp $ */
/*
* Implement 'meta' mode.
@@ -51,9 +51,9 @@
#endif
static BuildMon Mybm; /* for compat */
-static Lst metaBailiwick; /* our scope of control */
+static StringList *metaBailiwick; /* our scope of control */
static char *metaBailiwickStr; /* string storage for the list */
-static Lst metaIgnorePaths; /* paths we deliberately ignore */
+static StringList *metaIgnorePaths; /* paths we deliberately ignore */
static char *metaIgnorePathsStr; /* string storage for the list */
#ifndef MAKE_META_IGNORE_PATHS
@@ -1082,7 +1082,7 @@ meta_oodate(GNode *gn, Boolean oodate)
static size_t tmplen = 0;
FILE *fp;
Boolean needOODATE = FALSE;
- Lst missingFiles;
+ StringList *missingFiles;
char *pa[4]; /* >= possible uses */
int i;
int have_filemon = FALSE;
Index: src/usr.bin/make/nonints.h
diff -u src/usr.bin/make/nonints.h:1.123 src/usr.bin/make/nonints.h:1.124
--- src/usr.bin/make/nonints.h:1.123 Mon Sep 21 05:28:26 2020
+++ src/usr.bin/make/nonints.h Tue Sep 22 04:05:41 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: nonints.h,v 1.123 2020/09/21 05:28:26 rillig Exp $ */
+/* $NetBSD: nonints.h,v 1.124 2020/09/22 04:05:41 rillig Exp $ */
/*-
* Copyright (c) 1988, 1989, 1990, 1993
@@ -73,12 +73,12 @@
*/
/* arch.c */
-Boolean Arch_ParseArchive(char **, Lst, GNode *);
+Boolean Arch_ParseArchive(char **, GNodeList *, GNode *);
void Arch_Touch(GNode *);
void Arch_TouchLib(GNode *);
time_t Arch_MTime(GNode *);
time_t Arch_MemMTime(GNode *);
-void Arch_FindLib(GNode *, Lst);
+void Arch_FindLib(GNode *, SearchPath *);
Boolean Arch_LibOODate(GNode *);
void Arch_Init(void);
void Arch_End(void);
@@ -86,7 +86,7 @@ Boolean Arch_IsLib(GNode *);
/* compat.c */
int Compat_RunCommand(char *, GNode *);
-void Compat_Run(Lst);
+void Compat_Run(GNodeList *);
int Compat_Make(GNode *, GNode *);
/* cond.c */
@@ -128,7 +128,7 @@ void Parse_File(const char *, int);
void Parse_Init(void);
void Parse_End(void);
void Parse_SetInput(const char *, int, int, char *(*)(void *, size_t *), void *);
-Lst Parse_MainName(void);
+GNodeList *Parse_MainName(void);
/* str.c */
typedef struct {
@@ -156,12 +156,12 @@ Boolean Suff_IsTransform(char *);
GNode *Suff_AddTransform(char *);
void Suff_EndTransform(GNode *);
void Suff_AddSuffix(const char *, GNode **);
-Lst Suff_GetPath(char *);
+SearchPath *Suff_GetPath(char *);
void Suff_DoPaths(void);
void Suff_AddInclude(char *);
void Suff_AddLib(const char *);
void Suff_FindDeps(GNode *);
-Lst Suff_FindPath(GNode *);
+SearchPath *Suff_FindPath(GNode *);
void Suff_SetNull(char *);
void Suff_Init(void);
void Suff_End(void);
@@ -171,17 +171,17 @@ void Suff_PrintAll(void);
void Targ_Init(void);
void Targ_End(void);
void Targ_Stats(void);
-Lst Targ_List(void);
+GNodeList *Targ_List(void);
GNode *Targ_NewGN(const char *);
GNode *Targ_FindNode(const char *, int);
-Lst Targ_FindList(Lst, int);
+GNodeList *Targ_FindList(StringList *, int);
Boolean Targ_Ignore(GNode *);
Boolean Targ_Silent(GNode *);
Boolean Targ_Precious(GNode *);
void Targ_SetMain(GNode *);
void Targ_PrintCmds(GNode *);
void Targ_PrintNode(GNode *, int);
-void Targ_PrintNodes(Lst, int);
+void Targ_PrintNodes(GNodeList *, int);
char *Targ_FmtTime(time_t);
void Targ_PrintType(int);
void Targ_PrintGraph(int);
Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.321 src/usr.bin/make/parse.c:1.322
--- src/usr.bin/make/parse.c:1.321 Tue Sep 22 02:26:22 2020
+++ src/usr.bin/make/parse.c Tue Sep 22 04:05:41 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.321 2020/09/22 02:26:22 rillig Exp $ */
+/* $NetBSD: parse.c,v 1.322 2020/09/22 04:05:41 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -131,7 +131,7 @@
#include "pathnames.h"
/* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.321 2020/09/22 02:26:22 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.322 2020/09/22 04:05:41 rillig Exp $");
/* types and constants */
@@ -217,11 +217,11 @@ static GNode *mainNode;
/* During parsing, the targets from the previous dependency line.
*
* See unit-tests/deptgt.mk, keyword "parse.c:targets". */
-static Lst targets;
+static GNodeList *targets;
#ifdef CLEANUP
/* command lines for targets */
-static Lst targCmds;
+static StringList *targCmds;
#endif
/*
@@ -288,9 +288,9 @@ static IFile *curFile;
static Stack /* of *IFile */ includes;
/* include paths (lists of directories) */
-Lst parseIncPath; /* dirs for "..." includes */
-Lst sysIncPath; /* dirs for <...> includes */
-Lst defIncPath; /* default for sysIncPath */
+SearchPath *parseIncPath; /* dirs for "..." includes */
+SearchPath *sysIncPath; /* dirs for <...> includes */
+SearchPath *defIncPath; /* default for sysIncPath */
/* parser tables */
@@ -1081,7 +1081,7 @@ ParseFindMain(void *gnp, void *dummy MAK
static int
ParseAddDir(void *path, void *name)
{
- (void)Dir_AddDir((Lst) path, (char *)name);
+ (void)Dir_AddDir(path, name);
return 0;
}
@@ -1101,7 +1101,7 @@ ParseAddDir(void *path, void *name)
static int
ParseClearPath(void *path, void *dummy MAKE_ATTR_UNUSED)
{
- Dir_ClearPath((Lst) path);
+ Dir_ClearPath(path);
return 0;
}
@@ -1196,15 +1196,16 @@ ParseDependencyTargetWord(/*const*/ char
static void
ParseDoDependency(char *line)
{
+ typedef List SearchPathList;
+
char *cp; /* our current position */
int op; /* the operator on the line */
char savec; /* a place to save a character */
- Lst paths; /* List of search paths to alter when parsing
+ SearchPathList *paths; /* search paths to alter when parsing
* a list of .PATH targets */
int tOp; /* operator from special target */
- Lst sources; /* list of archive source names after
- * expansion */
- Lst curTargs; /* list of target names to be found and added
+ GNodeList *sources; /* archive sources after expansion */
+ StringList *curTargs; /* target names to be found and added
* to the targets list */
char *lstart = line;
@@ -1375,7 +1376,7 @@ ParseDoDependency(char *line)
* Call on the suffix module to give us a path to
* modify.
*/
- Lst path;
+ SearchPath *path;
specType = ExPath;
path = Suff_GetPath(&line[5]);
@@ -1405,7 +1406,7 @@ ParseDoDependency(char *line)
* use Dir_Destroy in the destruction of the path as the
* Dir module could have added a directory to the path...
*/
- Lst emptyPath = Lst_Init();
+ SearchPath *emptyPath = Lst_Init();
Dir_Expand(line, emptyPath, curTargs);
@@ -2169,7 +2170,7 @@ Parse_include_file(char *file, Boolean i
* If we have a suffix specific path we should use that.
*/
char *suff;
- Lst suffPath = NULL;
+ SearchPath *suffPath = NULL;
if ((suff = strrchr(file, '.'))) {
suffPath = Suff_GetPath(suff);
@@ -3189,10 +3190,10 @@ Parse_End(void)
*
*-----------------------------------------------------------------------
*/
-Lst
+GNodeList *
Parse_MainName(void)
{
- Lst mainList; /* result list */
+ GNodeList *mainList;
mainList = Lst_Init();
Index: src/usr.bin/make/suff.c
diff -u src/usr.bin/make/suff.c:1.156 src/usr.bin/make/suff.c:1.157
--- src/usr.bin/make/suff.c:1.156 Sun Sep 13 18:27:39 2020
+++ src/usr.bin/make/suff.c Tue Sep 22 04:05:41 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: suff.c,v 1.156 2020/09/13 18:27:39 rillig Exp $ */
+/* $NetBSD: suff.c,v 1.157 2020/09/22 04:05:41 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -126,7 +126,7 @@
#include "dir.h"
/* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */
-MAKE_RCSID("$NetBSD: suff.c,v 1.156 2020/09/13 18:27:39 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.157 2020/09/22 04:05:41 rillig Exp $");
#define SUFF_DEBUG0(fmt) \
if (!DEBUG(SUFF)) (void) 0; else fprintf(debug_file, fmt)
@@ -140,12 +140,18 @@ MAKE_RCSID("$NetBSD: suff.c,v 1.156 2020
#define SUFF_DEBUG3(fmt, arg1, arg2, arg3) \
if (!DEBUG(SUFF)) (void) 0; else fprintf(debug_file, fmt, arg1, arg2, arg3)
-static Lst sufflist; /* Lst of suffixes */
+typedef List SuffList;
+typedef ListNode SuffListNode;
+
+typedef List SrcList;
+typedef ListNode SrcListNode;
+
+static SuffList *sufflist; /* List of suffixes */
#ifdef CLEANUP
-static Lst suffClean; /* Lst of suffixes to be cleaned */
+static SuffList *suffClean; /* List of suffixes to be cleaned */
#endif
-static Lst srclist; /* Lst of sources */
-static Lst transforms; /* Lst of transformation rules */
+static SrcList *srclist; /* List of sources */
+static GNodeList *transforms; /* List of transformation rules */
static int sNum = 0; /* Counter for assigning suffix numbers */
@@ -159,6 +165,8 @@ typedef enum {
ENUM_FLAGS_RTTI_3(SuffFlags,
SUFF_INCLUDE, SUFF_LIBRARY, SUFF_NULL);
+typedef List SuffListList;
+
/*
* Structure describing an individual suffix.
*/
@@ -166,13 +174,13 @@ typedef struct Suff {
char *name; /* The suffix itself, such as ".c" */
int nameLen; /* Length of the name, to avoid strlen calls */
SuffFlags flags; /* Type of suffix */
- Lst searchPath; /* The path along which files of this suffix
+ SearchPath *searchPath; /* The path along which files of this suffix
* may be found */
int sNum; /* The suffix number */
int refCount; /* Reference count of list membership */
- Lst parents; /* Suffixes we have a transformation to */
- Lst children; /* Suffixes we have a transformation from */
- Lst ref; /* List of lists this suffix is referenced */
+ SuffList *parents; /* Suffixes we have a transformation to */
+ SuffList *children; /* Suffixes we have a transformation from */
+ SuffListList *ref; /* Lists in which this suffix is referenced */
} Suff;
/*
@@ -187,7 +195,7 @@ typedef struct _Src {
int children; /* Count of existing children (so we don't free
* this thing too early or never nuke it) */
#ifdef DEBUG_SRC
- Lst cp; /* Debug; children list */
+ SrcList *cp; /* Debug; children list */
#endif
} Src;
@@ -196,8 +204,8 @@ typedef struct _Src {
* function...
*/
typedef struct {
- Lst l;
- Src *s;
+ SrcList *l;
+ Src *s;
} LstSrc;
typedef struct {
@@ -213,19 +221,19 @@ static Suff *emptySuff; /* The empt
static void SuffUnRef(void *, void *);
static void SuffFree(void *);
-static void SuffInsert(Lst, Suff *);
-static void SuffRemove(Lst, Suff *);
+static void SuffInsert(SuffList *, Suff *);
+static void SuffRemove(SuffList *, Suff *);
static Boolean SuffParseTransform(char *, Suff **, Suff **);
static int SuffRebuildGraph(void *, void *);
static int SuffScanTargets(void *, void *);
static int SuffAddSrc(void *, void *);
-static void SuffAddLevel(Lst, Src *);
-static void SuffExpandChildren(LstNode, GNode *);
-static void SuffExpandWildcards(LstNode, GNode *);
+static void SuffAddLevel(SrcList *, Src *);
+static void SuffExpandChildren(GNodeListNode *, GNode *);
+static void SuffExpandWildcards(GNodeListNode *, GNode *);
static Boolean SuffApplyTransform(GNode *, GNode *, Suff *, Suff *);
-static void SuffFindDeps(GNode *, Lst);
-static void SuffFindArchiveDeps(GNode *, Lst);
-static void SuffFindNormalDeps(GNode *, Lst);
+static void SuffFindDeps(GNode *, SrcList *);
+static void SuffFindArchiveDeps(GNode *, SrcList *);
+static void SuffFindNormalDeps(GNode *, SrcList *);
static int SuffPrintName(void *, void *);
static int SuffPrintSuff(void *, void *);
static int SuffPrintTrans(void *, void *);
@@ -329,9 +337,9 @@ SuffGNHasName(const void *gn, const void
static void
SuffUnRef(void *lp, void *sp)
{
- Lst l = (Lst) lp;
+ SuffList *l = lp;
- LstNode ln = Lst_FindDatum(l, sp);
+ SuffListNode *ln = Lst_FindDatum(l, sp);
if (ln != NULL) {
Lst_Remove(l, ln);
((Suff *)sp)->refCount--;
@@ -368,7 +376,7 @@ SuffFree(void *sp)
/* Remove the suffix from the list, and free if it is otherwise unused. */
static void
-SuffRemove(Lst l, Suff *s)
+SuffRemove(SuffList *l, Suff *s)
{
SuffUnRef(l, s);
if (s->refCount == 0) {
@@ -384,9 +392,9 @@ SuffRemove(Lst l, Suff *s)
* s the suffix to insert
*/
static void
-SuffInsert(Lst l, Suff *s)
+SuffInsert(SuffList *l, Suff *s)
{
- LstNode ln; /* current element in l we're examining */
+ SuffListNode *ln; /* current element in l we're examining */
Suff *s2 = NULL; /* the suffix descriptor in this element */
Lst_Open(l);
@@ -467,14 +475,14 @@ Suff_ClearSuffixes(void)
static Boolean
SuffParseTransform(char *str, Suff **out_src, Suff **out_targ)
{
- LstNode srcLn; /* element in suffix list of trans source*/
- Suff *src; /* Source of transformation */
- LstNode targLn; /* element in suffix list of trans target*/
- char *str2; /* Extra pointer (maybe target suffix) */
- LstNode singleLn; /* element in suffix list of any suffix
- * that exactly matches str */
- Suff *single = NULL;/* Source of possible transformation to
- * null suffix */
+ SuffListNode *srcLn; /* element in suffix list of trans source*/
+ Suff *src; /* Source of transformation */
+ SuffListNode *targLn; /* element in suffix list of trans target*/
+ char *str2; /* Extra pointer (maybe target suffix) */
+ SuffListNode *singleLn; /* element in suffix list of any suffix
+ * that exactly matches str */
+ Suff *single = NULL; /* Source of possible transformation to
+ * null suffix */
srcLn = NULL;
singleLn = NULL;
@@ -556,7 +564,7 @@ Suff_AddTransform(char *line)
GNode *gn; /* GNode of transformation rule */
Suff *s, /* source suffix */
*t; /* target suffix */
- LstNode ln; /* Node for existing transformation */
+ GNodeListNode *ln; /* Node for existing transformation */
Boolean ok;
ln = Lst_Find(transforms, SuffGNHasName, line);
@@ -623,7 +631,7 @@ Suff_EndTransform(GNode *gn)
* actual transformation rules. (e.g. .DEFAULT)
*/
if (SuffParseTransform(gn->name, &s, &t)) {
- Lst p;
+ SuffList *p;
SUFF_DEBUG2("deleting transformation from `%s' to `%s'\n",
s->name, t->name);
@@ -675,7 +683,6 @@ SuffRebuildGraph(void *transformp, void
GNode *transform = (GNode *)transformp;
Suff *s = (Suff *)sp;
char *cp;
- LstNode ln;
Suff *s2;
SuffSuffGetSuffixArgs sd;
@@ -684,7 +691,7 @@ SuffRebuildGraph(void *transformp, void
*/
cp = UNCONST(SuffStrIsPrefix(s->name, transform->name));
if (cp != NULL) {
- ln = Lst_Find(sufflist, SuffSuffHasName, cp);
+ SuffListNode *ln = Lst_Find(sufflist, SuffSuffHasName, cp);
if (ln != NULL) {
/*
* Found target. Link in and return, since it can't be anything
@@ -704,6 +711,8 @@ SuffRebuildGraph(void *transformp, void
sd.ename = transform->name + sd.len;
cp = SuffSuffGetSuffix(s, &sd);
if (cp != NULL) {
+ SuffListNode *ln;
+
/*
* Null-terminate the source suffix in order to find it.
*/
@@ -792,7 +801,7 @@ void
Suff_AddSuffix(const char *name, GNode **gnp)
{
Suff *s; /* new suffix descriptor */
- LstNode ln;
+ SuffListNode *ln;
GNodeSuff gs;
ln = Lst_Find(sufflist, SuffSuffHasName, name);
@@ -819,11 +828,11 @@ Suff_AddSuffix(const char *name, GNode *
}
/* Return the search path for the given suffix, or NULL. */
-Lst
+SearchPath *
Suff_GetPath(char *sname)
{
- LstNode ln;
- Suff *s;
+ SuffListNode *ln;
+ Suff *s;
ln = Lst_Find(sufflist, SuffSuffHasName, sname);
if (ln == NULL) {
@@ -846,11 +855,11 @@ Suff_GetPath(char *sname)
void
Suff_DoPaths(void)
{
- Suff *s;
- LstNode ln;
- char *ptr;
- Lst inIncludes; /* Cumulative .INCLUDES path */
- Lst inLibs; /* Cumulative .LIBS path */
+ Suff *s;
+ SuffListNode *ln;
+ char *ptr;
+ SearchPath *inIncludes; /* Cumulative .INCLUDES path */
+ SearchPath *inLibs; /* Cumulative .LIBS path */
inIncludes = Lst_Init();
@@ -898,12 +907,9 @@ Suff_DoPaths(void)
void
Suff_AddInclude(char *sname)
{
- LstNode ln;
- Suff *s;
-
- ln = Lst_Find(sufflist, SuffSuffHasName, sname);
+ SuffListNode *ln = Lst_Find(sufflist, SuffSuffHasName, sname);
if (ln != NULL) {
- s = LstNode_Datum(ln);
+ Suff *s = LstNode_Datum(ln);
s->flags |= SUFF_INCLUDE;
}
}
@@ -919,12 +925,9 @@ Suff_AddInclude(char *sname)
void
Suff_AddLib(const char *sname)
{
- LstNode ln;
- Suff *s;
-
- ln = Lst_Find(sufflist, SuffSuffHasName, sname);
+ SuffListNode *ln = Lst_Find(sufflist, SuffSuffHasName, sname);
if (ln != NULL) {
- s = LstNode_Datum(ln);
+ Suff *s = LstNode_Datum(ln);
s->flags |= SUFF_LIBRARY;
}
}
@@ -1013,7 +1016,7 @@ SuffAddSrc(void *sp, void *lsp)
* targ Src structure to use as the parent
*/
static void
-SuffAddLevel(Lst l, Src *targ)
+SuffAddLevel(SrcList *l, Src *targ)
{
LstSrc ls;
@@ -1026,9 +1029,9 @@ SuffAddLevel(Lst l, Src *targ)
/* Free the first Src in the list that doesn't have a reference count.
* Return whether a Src was removed. */
static Boolean
-SuffRemoveSrc(Lst l)
+SuffRemoveSrc(SrcList *l)
{
- LstNode ln;
+ SrcListNode *ln;
Src *s;
Lst_Open(l);
@@ -1047,7 +1050,7 @@ SuffRemoveSrc(Lst l)
free(s->pref);
else {
#ifdef DEBUG_SRC
- LstNode ln2 = Lst_FindDatum(s->parent->cp, s);
+ SrcListNode *ln2 = Lst_FindDatum(s->parent->cp, s);
if (ln2 != NULL)
Lst_Remove(s->parent->cp, ln2);
#endif
@@ -1085,7 +1088,7 @@ SuffRemoveSrc(Lst l)
* The lowest structure in the chain of transformations, or NULL.
*/
static Src *
-SuffFindThem(Lst srcs, Lst slst)
+SuffFindThem(SrcList *srcs, SrcList *slst)
{
Src *s; /* current Src */
Src *rs; /* returned Src */
@@ -1142,9 +1145,11 @@ SuffFindThem(Lst srcs, Lst slst)
* The Src of the "winning" child, or NULL.
*/
static Src *
-SuffFindCmds(Src *targ, Lst slst)
+SuffFindCmds(Src *targ, SrcList *slst)
{
- LstNode ln; /* General-purpose list node */
+ GNodeListNode *gln;
+ SuffListNode *suffln;
+
GNode *t, /* Target GNode */
*s; /* Source GNode */
int prefLen;/* The length of the defined prefix */
@@ -1157,12 +1162,12 @@ SuffFindCmds(Src *targ, Lst slst)
prefLen = strlen(targ->pref);
for (;;) {
- ln = Lst_Next(t->children);
- if (ln == NULL) {
+ gln = Lst_Next(t->children);
+ if (gln == NULL) {
Lst_Close(t->children);
return NULL;
}
- s = LstNode_Datum(ln);
+ s = LstNode_Datum(gln);
if (s->type & OP_OPTIONAL && Lst_IsEmpty(t->commands)) {
/*
@@ -1187,8 +1192,8 @@ SuffFindCmds(Src *targ, Lst slst)
* The node matches the prefix ok, see if it has a known
* suffix.
*/
- ln = Lst_Find(sufflist, SuffSuffHasName, &cp[prefLen]);
- if (ln == NULL)
+ suffln = Lst_Find(sufflist, SuffSuffHasName, &cp[prefLen]);
+ if (suffln == NULL)
continue;
/*
* It even has a known suffix, see if there's a transformation
@@ -1196,7 +1201,7 @@ SuffFindCmds(Src *targ, Lst slst)
*
* XXX: Handle multi-stage transformations here, too.
*/
- suff = LstNode_Datum(ln);
+ suff = LstNode_Datum(suffln);
/* XXX: Can targ->suff be NULL here? */
if (targ->suff != NULL &&
@@ -1241,7 +1246,7 @@ SuffFindCmds(Src *targ, Lst slst)
* pgn Parent node being processed
*/
static void
-SuffExpandChildren(LstNode cln, GNode *pgn)
+SuffExpandChildren(GNodeListNode *cln, GNode *pgn)
{
GNode *cgn = LstNode_Datum(cln);
GNode *gn; /* New source 8) */
@@ -1270,7 +1275,7 @@ SuffExpandChildren(LstNode cln, GNode *p
cp = Var_Subst(cgn->name, pgn, VARE_UNDEFERR|VARE_WANTRES);
{
- Lst members = Lst_Init();
+ GNodeList *members = Lst_Init();
if (cgn->type & OP_ARCHV) {
/*
@@ -1393,12 +1398,10 @@ SuffExpandChildren(LstNode cln, GNode *p
}
static void
-SuffExpandWildcards(LstNode cln, GNode *pgn)
+SuffExpandWildcards(GNodeListNode *cln, GNode *pgn)
{
GNode *cgn = LstNode_Datum(cln);
- GNode *gn; /* New source 8) */
- char *cp; /* Expanded value */
- Lst explist; /* List of expansions */
+ StringList *explist;
if (!Dir_HasWildcards(cgn->name))
return;
@@ -1410,10 +1413,11 @@ SuffExpandWildcards(LstNode cln, GNode *
Dir_Expand(cgn->name, Suff_FindPath(cgn), explist);
while (!Lst_IsEmpty(explist)) {
+ GNode *gn;
/*
* Fetch next expansion off the list and find its GNode
*/
- cp = Lst_Dequeue(explist);
+ char *cp = Lst_Dequeue(explist);
SUFF_DEBUG1("%s...", cp);
gn = Targ_FindNode(cp, TARG_CREATE);
@@ -1448,14 +1452,14 @@ SuffExpandWildcards(LstNode cln, GNode *
* Results:
* The appropriate path to search for the GNode.
*/
-Lst
+SearchPath *
Suff_FindPath(GNode* gn)
{
Suff *suff = gn->suffix;
if (suff == NULL) {
SuffSuffGetSuffixArgs sd; /* Search string data */
- LstNode ln;
+ SuffListNode *ln;
sd.len = strlen(gn->name);
sd.ename = gn->name + sd.len;
ln = Lst_Find(sufflist, SuffSuffIsSuffix, &sd);
@@ -1499,7 +1503,7 @@ Suff_FindPath(GNode* gn)
static Boolean
SuffApplyTransform(GNode *tGn, GNode *sGn, Suff *t, Suff *s)
{
- LstNode ln, nln; /* General node */
+ GNodeListNode *ln, *nln; /* General node */
char *tname; /* Name of transformation rule */
GNode *gn; /* Node for same */
@@ -1567,14 +1571,14 @@ SuffApplyTransform(GNode *tGn, GNode *sG
* Same as Suff_FindDeps
*/
static void
-SuffFindArchiveDeps(GNode *gn, Lst slst)
+SuffFindArchiveDeps(GNode *gn, SrcList *slst)
{
- char *eoarch; /* End of archive portion */
- char *eoname; /* End of member portion */
- GNode *mem; /* Node for member */
- LstNode ln, nln; /* Next suffix node to check */
- Suff *ms; /* Suffix descriptor for member */
- char *name; /* Start of member's name */
+ char *eoarch; /* End of archive portion */
+ char *eoname; /* End of member portion */
+ GNode *mem; /* Node for member */
+ SuffListNode *ln, *nln; /* Next suffix node to check */
+ Suff *ms; /* Suffix descriptor for member */
+ char *name; /* Start of member's name */
/*
* The node is an archive(member) pair. so we must find a
@@ -1713,13 +1717,13 @@ SuffFindArchiveDeps(GNode *gn, Lst slst)
* Same as Suff_FindDeps
*/
static void
-SuffFindNormalDeps(GNode *gn, Lst slst)
+SuffFindNormalDeps(GNode *gn, SrcList *slst)
{
char *eoname; /* End of name */
char *sopref; /* Start of prefix */
- LstNode ln, nln; /* Next suffix node to check */
- Lst srcs; /* List of sources at which to look */
- Lst targs; /* List of targets to which things can be
+ SuffListNode *ln, *nln;
+ SrcList *srcs; /* List of sources at which to look */
+ SrcList *targs; /* List of targets to which things can be
* transformed. They all have the same file,
* but different suff and pref fields */
Src *bottom; /* Start of found transformation path */
@@ -2079,7 +2083,7 @@ Suff_FindDeps(GNode *gn)
}
static void
-SuffFindDeps(GNode *gn, Lst slst)
+SuffFindDeps(GNode *gn, SrcList *slst)
{
if (gn->type & OP_DEPS_FOUND)
return;
@@ -2104,7 +2108,7 @@ SuffFindDeps(GNode *gn, Lst slst)
* set the TARGET variable to the node's name in order to give it a
* value).
*/
- LstNode ln;
+ SuffListNode *ln;
Suff *s;
ln = Lst_Find(sufflist, SuffSuffHasName, LIBSUFF);
@@ -2141,7 +2145,7 @@ void
Suff_SetNull(char *name)
{
Suff *s;
- LstNode ln;
+ SuffListNode *ln;
ln = Lst_Find(sufflist, SuffSuffHasName, name);
if (ln != NULL) {
Index: src/usr.bin/make/targ.c
diff -u src/usr.bin/make/targ.c:1.88 src/usr.bin/make/targ.c:1.89
--- src/usr.bin/make/targ.c:1.88 Sun Sep 13 15:15:51 2020
+++ src/usr.bin/make/targ.c Tue Sep 22 04:05:41 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: targ.c,v 1.88 2020/09/13 15:15:51 rillig Exp $ */
+/* $NetBSD: targ.c,v 1.89 2020/09/22 04:05:41 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -122,11 +122,11 @@
#include "dir.h"
/* "@(#)targ.c 8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: targ.c,v 1.88 2020/09/13 15:15:51 rillig Exp $");
+MAKE_RCSID("$NetBSD: targ.c,v 1.89 2020/09/22 04:05:41 rillig Exp $");
-static Lst allTargets; /* the list of all targets found so far */
+static GNodeList *allTargets; /* the list of all targets found so far */
#ifdef CLEANUP
-static Lst allGNs; /* List of all the GNodes */
+static GNodeList *allGNs; /* List of all the GNodes */
#endif
static Hash_Table targets; /* a hash table of same */
@@ -161,7 +161,7 @@ Targ_Stats(void)
}
/* Return the list of all targets. */
-Lst
+GNodeList *
Targ_List(void)
{
return allTargets;
@@ -296,26 +296,19 @@ Targ_FindNode(const char *name, int flag
* A complete list of graph nodes corresponding to all instances of all
* the names in names.
*/
-Lst
-Targ_FindList(Lst names, int flags)
+GNodeList *
+Targ_FindList(StringList *names, int flags)
{
- Lst nodes; /* result list */
- LstNode ln; /* name list element */
- GNode *gn; /* node in tLn */
- char *name;
+ GNodeList *nodes;
+ StringListNode *ln;
nodes = Lst_Init();
Lst_Open(names);
while ((ln = Lst_Next(names)) != NULL) {
- name = LstNode_Datum(ln);
- gn = Targ_FindNode(name, flags);
+ char *name = LstNode_Datum(ln);
+ GNode *gn = Targ_FindNode(name, flags);
if (gn != NULL) {
- /*
- * Note: Lst_Append must come before the Lst_Concat so the nodes
- * are added to the list in the order in which they were
- * encountered in the makefile.
- */
Lst_Append(nodes, gn);
} else if (flags == TARG_NOCREATE) {
Error("\"%s\" -- target unknown.", name);
@@ -359,9 +352,9 @@ Targ_SetMain(GNode *gn)
}
static void
-PrintNodeNames(Lst gnodes)
+PrintNodeNames(GNodeList *gnodes)
{
- LstNode node;
+ GNodeListNode *node;
for (node = Lst_First(gnodes); node != NULL; node = LstNode_Next(node)) {
GNode *gn = LstNode_Datum(node);
@@ -370,7 +363,7 @@ PrintNodeNames(Lst gnodes)
}
static void
-PrintNodeNamesLine(const char *label, Lst gnodes)
+PrintNodeNamesLine(const char *label, GNodeList *gnodes)
{
if (Lst_IsEmpty(gnodes))
return;
@@ -529,7 +522,7 @@ Targ_PrintNode(GNode *gn, int pass)
}
void
-Targ_PrintNodes(Lst gnodes, int pass)
+Targ_PrintNodes(GNodeList *gnodes, int pass)
{
Lst_ForEach(gnodes, PrintNode, &pass);
}
@@ -582,7 +575,7 @@ Targ_PrintGraph(int pass)
void
Targ_Propagate(void)
{
- LstNode pn, cn;
+ GNodeListNode *pn, *cn;
for (pn = Lst_First(allTargets); pn != NULL; pn = LstNode_Next(pn)) {
GNode *pgn = LstNode_Datum(pn);
Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.523 src/usr.bin/make/var.c:1.524
--- src/usr.bin/make/var.c:1.523 Mon Sep 21 05:28:26 2020
+++ src/usr.bin/make/var.c Tue Sep 22 04:05:41 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.523 2020/09/21 05:28:26 rillig Exp $ */
+/* $NetBSD: var.c,v 1.524 2020/09/22 04:05:41 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -121,7 +121,7 @@
#include "metachar.h"
/* "@(#)var.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.523 2020/09/21 05:28:26 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.524 2020/09/22 04:05:41 rillig Exp $");
#define VAR_DEBUG_IF(cond, fmt, ...) \
if (!(DEBUG(VAR) && (cond))) \
@@ -2114,7 +2114,7 @@ ApplyModifier_Path(const char **pp, Appl
} else if (gn->path) {
path = bmake_strdup(gn->path);
} else {
- Lst searchPath = Suff_FindPath(gn);
+ SearchPath *searchPath = Suff_FindPath(gn);
path = Dir_FindFile(st->v->name, searchPath);
}
if (path == NULL)