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_ForEachUntil in ParseDoDepe...
details: https://anonhg.NetBSD.org/src/rev/c67448f3f4ae
branches: trunk
changeset: 944359:c67448f3f4ae
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Sep 27 12:05:04 2020 +0000
description:
make(1): inline Lst_ForEachUntil in ParseDoDependency
diffstat:
usr.bin/make/parse.c | 60 +++++++++++++++++++--------------------------------
1 files changed, 22 insertions(+), 38 deletions(-)
diffs (89 lines):
diff -r 2a6b96552707 -r c67448f3f4ae usr.bin/make/parse.c
--- a/usr.bin/make/parse.c Sun Sep 27 11:57:28 2020 +0000
+++ b/usr.bin/make/parse.c Sun Sep 27 12:05:04 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.334 2020/09/26 17:39:45 rillig Exp $ */
+/* $NetBSD: parse.c,v 1.335 2020/09/27 12:05:04 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.334 2020/09/26 17:39:45 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.335 2020/09/27 12:05:04 rillig Exp $");
/* types and constants */
@@ -1030,34 +1030,26 @@
}
}
-/*-
- *-----------------------------------------------------------------------
- * ParseFindMain --
- * Find a real target in the list and set it to be the main one.
- * Called by ParseDoDependency when a main target hasn't been found
- * yet.
- *
- * Input:
- * gnp Node to examine
- *
- * Results:
- * 0 if main not found yet, 1 if it is.
- *
- * Side Effects:
- * mainNode is changed and Targ_SetMain is called.
- *
- *-----------------------------------------------------------------------
- */
-static int
-ParseFindMain(void *gnp, void *dummy MAKE_ATTR_UNUSED)
+/* If we have yet to decide on a main target to make, in the absence of any
+ * user input, we want the first target on the first dependency line that is
+ * actually a real target (i.e. isn't a .USE or .EXEC rule) to be made. */
+static void
+FindMainTarget(void)
{
- GNode *gn = (GNode *)gnp;
- if (!(gn->type & OP_NOTARGET)) {
- mainNode = gn;
- Targ_SetMain(gn);
- return 1;
- } else {
- return 0;
+ GNodeListNode *ln;
+
+ if (mainNode != NULL)
+ return;
+ if (targets == NULL)
+ return;
+
+ for (ln = targets->first; ln != NULL; ln = ln->next) {
+ GNode *gn = ln->datum;
+ if (!(gn->type & OP_NOTARGET)) {
+ mainNode = gn;
+ Targ_SetMain(gn);
+ return;
+ }
}
}
@@ -1688,15 +1680,7 @@
}
}
- if (mainNode == NULL && targets != NULL) {
- /*
- * If we have yet to decide on a main target to make, in the
- * absence of any user input, we want the first target on
- * the first dependency line that is actually a real target
- * (i.e. isn't a .USE or .EXEC rule) to be made.
- */
- Lst_ForEachUntil(targets, ParseFindMain, NULL);
- }
+ FindMainTarget();
out:
if (paths != NULL)
Home |
Main Index |
Thread Index |
Old Index