Module Name: src
Committed By: rillig
Date: Sat Sep 26 17:02:11 UTC 2020
Modified Files:
src/usr.bin/make: targ.c
Log Message:
make(1): inline Lst_ForEach in Targ_PrintGraph
To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 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/targ.c
diff -u src/usr.bin/make/targ.c:1.99 src/usr.bin/make/targ.c:1.100
--- src/usr.bin/make/targ.c:1.99 Sat Sep 26 16:55:58 2020
+++ src/usr.bin/make/targ.c Sat Sep 26 17:02:11 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: targ.c,v 1.99 2020/09/26 16:55:58 rillig Exp $ */
+/* $NetBSD: targ.c,v 1.100 2020/09/26 17:02:11 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -121,7 +121,7 @@
#include "dir.h"
/* "@(#)targ.c 8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: targ.c,v 1.99 2020/09/26 16:55:58 rillig Exp $");
+MAKE_RCSID("$NetBSD: targ.c,v 1.100 2020/09/26 17:02:11 rillig Exp $");
static GNodeList *allTargets; /* the list of all targets found so far */
#ifdef CLEANUP
@@ -511,19 +511,22 @@ Targ_PrintNodes(GNodeList *gnodes, int p
Lst_ForEach(gnodes, PrintNode, &pass);
}
-/* Print only those targets that are just a source.
- * The name of each file is printed, preceded by #\t. */
+/* Print only those targets that are just a source. */
static void
-TargPrintOnlySrc(void *gnp, void *dummy MAKE_ATTR_UNUSED)
+PrintOnlySources(void)
{
- GNode *gn = (GNode *)gnp;
- if (!OP_NOP(gn->type))
- return;
+ GNodeListNode *ln;
- fprintf(debug_file, "#\t%s [%s]",
- gn->name, gn->path ? gn->path : gn->name);
- Targ_PrintType(gn->type);
- fprintf(debug_file, "\n");
+ for (ln = allTargets->first; ln != NULL; ln = ln->next) {
+ GNode *gn = ln->datum;
+ if (!OP_NOP(gn->type))
+ continue;
+
+ fprintf(debug_file, "#\t%s [%s]",
+ gn->name, gn->path ? gn->path : gn->name);
+ Targ_PrintType(gn->type);
+ fprintf(debug_file, "\n");
+ }
}
/* Input:
@@ -535,10 +538,10 @@ void
Targ_PrintGraph(int pass)
{
fprintf(debug_file, "#*** Input graph:\n");
- Lst_ForEach(allTargets, PrintNode, &pass);
+ Targ_PrintNodes(allTargets, pass);
fprintf(debug_file, "\n\n");
fprintf(debug_file, "#\n# Files that are only sources:\n");
- Lst_ForEach(allTargets, TargPrintOnlySrc, NULL);
+ PrintOnlySources();
fprintf(debug_file, "#*** Global Variables:\n");
Var_Dump(VAR_GLOBAL);
fprintf(debug_file, "#*** Command-line Variables:\n");