Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make make(1): inline Lst_Copy in Make_ExpandUse
details: https://anonhg.NetBSD.org/src/rev/241f8e7133c4
branches: trunk
changeset: 956265:241f8e7133c4
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Oct 25 10:07:23 2020 +0000
description:
make(1): inline Lst_Copy in Make_ExpandUse
diffstat:
usr.bin/make/lst.c | 23 ++---------------------
usr.bin/make/lst.h | 8 +-------
usr.bin/make/make.c | 14 +++++++++++---
3 files changed, 14 insertions(+), 31 deletions(-)
diffs (108 lines):
diff -r 844206eb7e26 -r 241f8e7133c4 usr.bin/make/lst.c
--- a/usr.bin/make/lst.c Sun Oct 25 10:00:20 2020 +0000
+++ b/usr.bin/make/lst.c Sun Oct 25 10:07:23 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.c,v 1.87 2020/10/24 10:36:23 rillig Exp $ */
+/* $NetBSD: lst.c,v 1.88 2020/10/25 10:07:23 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -34,7 +34,7 @@
#include "make.h"
-MAKE_RCSID("$NetBSD: lst.c,v 1.87 2020/10/24 10:36:23 rillig Exp $");
+MAKE_RCSID("$NetBSD: lst.c,v 1.88 2020/10/25 10:07:23 rillig Exp $");
static ListNode *
LstNodeNew(ListNode *prev, ListNode *next, void *datum)
@@ -58,25 +58,6 @@
return list;
}
-/* 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. */
-List *
-Lst_Copy(List *list, LstCopyProc copyProc)
-{
- List *newList;
- ListNode *node;
-
- newList = Lst_New();
-
- for (node = list->first; node != NULL; node = node->next) {
- void *datum = copyProc != NULL ? copyProc(node->datum) : node->datum;
- Lst_Append(newList, datum);
- }
-
- return newList;
-}
-
/* Free a list and all its nodes. The node data are not freed though. */
void
Lst_Free(List *list)
diff -r 844206eb7e26 -r 241f8e7133c4 usr.bin/make/lst.h
--- a/usr.bin/make/lst.h Sun Oct 25 10:00:20 2020 +0000
+++ b/usr.bin/make/lst.h Sun Oct 25 10:07:23 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.h,v 1.79 2020/10/24 10:36:23 rillig Exp $ */
+/* $NetBSD: lst.h,v 1.80 2020/10/25 10:07:23 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -102,10 +102,6 @@
ListNode *last; /* last node in list */
};
-/* Copy a node, usually by allocating a copy of the given object.
- * For reference-counted objects, the original object may need to be
- * modified, therefore the parameter is not const. */
-typedef void *LstCopyProc(void *);
/* Free the datum of a node, called before freeing the node itself. */
typedef void LstFreeProc(void *);
/* An action for Lst_ForEachUntil and Lst_ForEachUntilConcurrent. */
@@ -115,8 +111,6 @@
/* Create a new list. */
List *Lst_New(void);
-/* Duplicate an existing list. */
-List *Lst_Copy(List *, LstCopyProc);
/* Free the list, leaving the node data unmodified. */
void Lst_Free(List *);
/* Free the list, freeing the node data using the given function. */
diff -r 844206eb7e26 -r 241f8e7133c4 usr.bin/make/make.c
--- a/usr.bin/make/make.c Sun Oct 25 10:00:20 2020 +0000
+++ b/usr.bin/make/make.c Sun Oct 25 10:07:23 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: make.c,v 1.178 2020/10/23 19:48:17 rillig Exp $ */
+/* $NetBSD: make.c,v 1.179 2020/10/25 10:07:23 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -107,7 +107,7 @@
#include "job.h"
/* "@(#)make.c 8.1 (Berkeley) 6/6/93" */
-MAKE_RCSID("$NetBSD: make.c,v 1.178 2020/10/23 19:48:17 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.179 2020/10/25 10:07:23 rillig Exp $");
/* Sequence # to detect recursion. */
static unsigned int checked = 1;
@@ -1126,7 +1126,15 @@
{
GNodeList *examine; /* List of targets to examine */
- examine = Lst_Copy(targs, NULL);
+ {
+ /* XXX: Why is it necessary to copy the list? There shouldn't be
+ * any modifications to the list, at least the function name
+ * ExpandUse doesn't suggest that. */
+ GNodeListNode *ln;
+ examine = Lst_New();
+ for (ln = targs->first; ln != NULL; ln = ln->next)
+ Lst_Append(examine, ln->datum);
+ }
/*
* Make an initial downward pass over the graph, marking nodes to be made
Home |
Main Index |
Thread Index |
Old Index