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_ForEach in Targ_PrintGraph



details:   https://anonhg.NetBSD.org/src/rev/84da692644cc
branches:  trunk
changeset: 944331:84da692644cc
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Sep 26 17:02:11 2020 +0000

description:
make(1): inline Lst_ForEach in Targ_PrintGraph

diffstat:

 usr.bin/make/targ.c |  31 +++++++++++++++++--------------
 1 files changed, 17 insertions(+), 14 deletions(-)

diffs (64 lines):

diff -r 3f8c011b9e6d -r 84da692644cc usr.bin/make/targ.c
--- a/usr.bin/make/targ.c       Sat Sep 26 16:55:58 2020 +0000
+++ b/usr.bin/make/targ.c       Sat Sep 26 17:02:11 2020 +0000
@@ -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 @@
     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 @@
 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");



Home | Main Index | Thread Index | Old Index