Module Name: src
Committed By: rillig
Date: Sat Nov 28 19:22:32 UTC 2020
Modified Files:
src/usr.bin/make: compat.c dir.c make.c make.h suff.c targ.c
Log Message:
make(1): reduce pointer indirection for GNode.implicitParents
To generate a diff of this commit:
cvs rdiff -u -r1.195 -r1.196 src/usr.bin/make/compat.c
cvs rdiff -u -r1.222 -r1.223 src/usr.bin/make/dir.c src/usr.bin/make/make.c
cvs rdiff -u -r1.224 -r1.225 src/usr.bin/make/make.h
cvs rdiff -u -r1.312 -r1.313 src/usr.bin/make/suff.c
cvs rdiff -u -r1.145 -r1.146 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/compat.c
diff -u src/usr.bin/make/compat.c:1.195 src/usr.bin/make/compat.c:1.196
--- src/usr.bin/make/compat.c:1.195 Sat Nov 28 19:20:03 2020
+++ src/usr.bin/make/compat.c Sat Nov 28 19:22:32 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: compat.c,v 1.195 2020/11/28 19:20:03 rillig Exp $ */
+/* $NetBSD: compat.c,v 1.196 2020/11/28 19:22:32 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -96,7 +96,7 @@
#include "pathnames.h"
/* "@(#)compat.c 8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: compat.c,v 1.195 2020/11/28 19:20:03 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.196 2020/11/28 19:22:32 rillig Exp $");
static GNode *curTarg = NULL;
static pid_t compatChild;
@@ -495,7 +495,7 @@ MakeUnmade(GNode *const gn, GNode *const
return FALSE;
}
- if (Lst_FindDatum(gn->implicitParents, pgn) != NULL)
+ if (Lst_FindDatum(&gn->implicitParents, pgn) != NULL)
Var_Set(IMPSRC, GNode_VarTarget(gn), pgn);
/*
@@ -587,7 +587,7 @@ static void
MakeOther(GNode *gn, GNode *pgn)
{
- if (Lst_FindDatum(gn->implicitParents, pgn) != NULL) {
+ if (Lst_FindDatum(&gn->implicitParents, pgn) != NULL) {
const char *target = GNode_VarTarget(gn);
Var_Set(IMPSRC, target != NULL ? target : "", pgn);
}
Index: src/usr.bin/make/dir.c
diff -u src/usr.bin/make/dir.c:1.222 src/usr.bin/make/dir.c:1.223
--- src/usr.bin/make/dir.c:1.222 Mon Nov 23 23:41:11 2020
+++ src/usr.bin/make/dir.c Sat Nov 28 19:22:32 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: dir.c,v 1.222 2020/11/23 23:41:11 rillig Exp $ */
+/* $NetBSD: dir.c,v 1.223 2020/11/28 19:22:32 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.222 2020/11/23 23:41:11 rillig Exp $");
+MAKE_RCSID("$NetBSD: dir.c,v 1.223 2020/11/28 19:22:32 rillig Exp $");
#define DIR_DEBUG0(text) DEBUG0(DIR, text)
#define DIR_DEBUG1(fmt, arg1) DEBUG1(DIR, fmt, arg1)
@@ -1337,7 +1337,7 @@ ResolveFullName(GNode *gn)
fullName = Dir_FindFile(gn->name, Suff_FindPath(gn));
if (fullName == NULL && gn->flags & FROM_DEPEND &&
- !Lst_IsEmpty(gn->implicitParents))
+ !Lst_IsEmpty(&gn->implicitParents))
fullName = ResolveMovedDepends(gn);
DIR_DEBUG2("Found '%s' as '%s'\n",
Index: src/usr.bin/make/make.c
diff -u src/usr.bin/make/make.c:1.222 src/usr.bin/make/make.c:1.223
--- src/usr.bin/make/make.c:1.222 Sat Nov 28 19:20:03 2020
+++ src/usr.bin/make/make.c Sat Nov 28 19:22:32 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: make.c,v 1.222 2020/11/28 19:20:03 rillig Exp $ */
+/* $NetBSD: make.c,v 1.223 2020/11/28 19:22:32 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -102,7 +102,7 @@
#include "job.h"
/* "@(#)make.c 8.1 (Berkeley) 6/6/93" */
-MAKE_RCSID("$NetBSD: make.c,v 1.222 2020/11/28 19:20:03 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.223 2020/11/28 19:22:32 rillig Exp $");
/* Sequence # to detect recursion. */
static unsigned int checked_seqno = 1;
@@ -550,7 +550,7 @@ UpdateImplicitParentsVars(GNode *cgn, co
GNodeListNode *ln;
const char *cpref = GNode_VarPrefix(cgn);
- for (ln = cgn->implicitParents->first; ln != NULL; ln = ln->next) {
+ for (ln = cgn->implicitParents.first; ln != NULL; ln = ln->next) {
GNode *pgn = ln->datum;
if (pgn->flags & REMAKE) {
Var_Set(IMPSRC, cname, pgn);
Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.224 src/usr.bin/make/make.h:1.225
--- src/usr.bin/make/make.h:1.224 Sat Nov 28 19:20:03 2020
+++ src/usr.bin/make/make.h Sat Nov 28 19:22:32 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: make.h,v 1.224 2020/11/28 19:20:03 rillig Exp $ */
+/* $NetBSD: make.h,v 1.225 2020/11/28 19:22:32 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -383,7 +383,7 @@ typedef struct GNode {
/* The GNodes for which this node is an implied source. May be empty.
* For example, when there is an inference rule for .c.o, the node for
* file.c has the node for file.o in this list. */
- GNodeList *implicitParents;
+ GNodeList implicitParents;
/* The nodes that depend on this one, or in other words, the nodes for
* which this is a source. */
Index: src/usr.bin/make/suff.c
diff -u src/usr.bin/make/suff.c:1.312 src/usr.bin/make/suff.c:1.313
--- src/usr.bin/make/suff.c:1.312 Sat Nov 28 19:20:03 2020
+++ src/usr.bin/make/suff.c Sat Nov 28 19:22:32 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: suff.c,v 1.312 2020/11/28 19:20:03 rillig Exp $ */
+/* $NetBSD: suff.c,v 1.313 2020/11/28 19:22:32 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
#include "dir.h"
/* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */
-MAKE_RCSID("$NetBSD: suff.c,v 1.312 2020/11/28 19:20:03 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.313 2020/11/28 19:22:32 rillig Exp $");
#define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
#define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -1484,7 +1484,7 @@ ApplyTransform(GNode *tgn, GNode *sgn, S
* Keep track of another parent to which this node is transformed so
* the .IMPSRC variable can be set correctly for the parent.
*/
- Lst_Append(sgn->implicitParents, tgn);
+ Lst_Append(&sgn->implicitParents, tgn);
return TRUE;
}
Index: src/usr.bin/make/targ.c
diff -u src/usr.bin/make/targ.c:1.145 src/usr.bin/make/targ.c:1.146
--- src/usr.bin/make/targ.c:1.145 Sat Nov 28 19:20:04 2020
+++ src/usr.bin/make/targ.c Sat Nov 28 19:22:32 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: targ.c,v 1.145 2020/11/28 19:20:04 rillig Exp $ */
+/* $NetBSD: targ.c,v 1.146 2020/11/28 19:22:32 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -119,7 +119,7 @@
#include "dir.h"
/* "@(#)targ.c 8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: targ.c,v 1.145 2020/11/28 19:20:04 rillig Exp $");
+MAKE_RCSID("$NetBSD: targ.c,v 1.146 2020/11/28 19:22:32 rillig Exp $");
/*
* All target nodes that appeared on the left-hand side of one of the
@@ -201,7 +201,7 @@ GNode_New(const char *name)
gn->unmade = 0;
gn->mtime = 0;
gn->youngestChild = NULL;
- gn->implicitParents = Lst_New();
+ Lst_Init(&gn->implicitParents);
Lst_Init(&gn->parents);
Lst_Init(&gn->children);
Lst_Init(&gn->order_pred);
@@ -234,7 +234,7 @@ GNode_Free(void *gnp)
free(gn->uname);
free(gn->path);
/* gn->youngestChild is not owned by this node. */
- Lst_Free(gn->implicitParents); /* Do not free the nodes themselves, */
+ Lst_Done(&gn->implicitParents); /* Do not free the nodes themselves, */
Lst_Done(&gn->parents); /* as they are not owned by this node. */
Lst_Done(&gn->children); /* likewise */
Lst_Done(&gn->order_pred); /* likewise */
@@ -503,7 +503,7 @@ Targ_PrintNode(GNode *gn, int pass)
debug_printf("# unmade\n");
}
}
- PrintNodeNamesLine("implicit parents", gn->implicitParents);
+ PrintNodeNamesLine("implicit parents", &gn->implicitParents);
} else {
if (gn->unmade)
debug_printf("# %d unmade children\n", gn->unmade);