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): remove void pointers from suffix debug...



details:   https://anonhg.NetBSD.org/src/rev/e0fb46d1fa79
branches:  trunk
changeset: 956054:e0fb46d1fa79
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Oct 19 21:17:35 2020 +0000

description:
make(1): remove void pointers from suffix debug printing

diffstat:

 usr.bin/make/suff.c |  54 ++++++++++++++++++++++++++++++----------------------
 usr.bin/make/targ.c |  10 ++++----
 2 files changed, 36 insertions(+), 28 deletions(-)

diffs (134 lines):

diff -r 07b026d7d90c -r e0fb46d1fa79 usr.bin/make/suff.c
--- a/usr.bin/make/suff.c       Mon Oct 19 20:55:30 2020 +0000
+++ b/usr.bin/make/suff.c       Mon Oct 19 21:17:35 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: suff.c,v 1.190 2020/10/18 17:41:06 rillig Exp $        */
+/*     $NetBSD: suff.c,v 1.191 2020/10/19 21:17:35 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -129,7 +129,7 @@
 #include "dir.h"
 
 /*     "@(#)suff.c     8.4 (Berkeley) 3/21/94" */
-MAKE_RCSID("$NetBSD: suff.c,v 1.190 2020/10/18 17:41:06 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.191 2020/10/19 21:17:35 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -2110,18 +2110,22 @@
 /********************* DEBUGGING FUNCTIONS **********************/
 
 static void
-SuffPrintName(void *s, void *dummy MAKE_ATTR_UNUSED)
+PrintSuffNames(const char *prefix, SuffList *suffs)
 {
-    debug_printf("%s ", ((Suff *)s)->name);
+    SuffListNode *ln;
+
+    debug_printf("#\t%s: ", prefix);
+    for (ln = suffs->first; ln != NULL; ln = ln->next) {
+       Suff *suff = ln->datum;
+       debug_printf("%s ", suff->name);
+    }
+    debug_printf("\n");
 }
 
 static void
-SuffPrintSuff(void *sp, void *dummy MAKE_ATTR_UNUSED)
+PrintSuff(Suff *s)
 {
-    Suff    *s = (Suff *)sp;
-
     debug_printf("# `%s' [%d] ", s->name, s->refCount);
-
     if (s->flags != 0) {
        char flags_buf[SuffFlags_ToStringSize];
 
@@ -2129,36 +2133,40 @@
                     Enum_FlagsToString(flags_buf, sizeof flags_buf,
                                        s->flags, SuffFlags_ToStringSpecs));
     }
-    fputc('\n', debug_file);
-    debug_printf("#\tTo: ");
-    Lst_ForEach(s->parents, SuffPrintName, NULL);
-    fputc('\n', debug_file);
-    debug_printf("#\tFrom: ");
-    Lst_ForEach(s->children, SuffPrintName, NULL);
-    fputc('\n', debug_file);
+    debug_printf("\n");
+
+    PrintSuffNames("To", s->parents);
+    PrintSuffNames("From", s->children);
+
     debug_printf("#\tSearch Path: ");
     Dir_PrintPath(s->searchPath);
-    fputc('\n', debug_file);
+    debug_printf("\n");
 }
 
 static void
-SuffPrintTrans(void *tp, void *dummy MAKE_ATTR_UNUSED)
+PrintTransformation(GNode *t)
 {
-    GNode   *t = (GNode *)tp;
-
     debug_printf("%-16s:", t->name);
     Targ_PrintType(t->type);
-    fputc('\n', debug_file);
+    debug_printf("\n");
     Targ_PrintCmds(t);
-    fputc('\n', debug_file);
+    debug_printf("\n");
 }
 
 void
 Suff_PrintAll(void)
 {
     debug_printf("#*** Suffixes:\n");
-    Lst_ForEach(sufflist, SuffPrintSuff, NULL);
+    {
+       SuffListNode *ln;
+       for (ln = sufflist->first; ln != NULL; ln = ln->next)
+           PrintSuff(ln->datum);
+    }
 
     debug_printf("#*** Transformations:\n");
-    Lst_ForEach(transforms, SuffPrintTrans, NULL);
+    {
+       GNodeListNode *ln;
+       for (ln = transforms->first; ln != NULL; ln = ln->next)
+           PrintTransformation(ln->datum);
+    }
 }
diff -r 07b026d7d90c -r e0fb46d1fa79 usr.bin/make/targ.c
--- a/usr.bin/make/targ.c       Mon Oct 19 20:55:30 2020 +0000
+++ b/usr.bin/make/targ.c       Mon Oct 19 21:17:35 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: targ.c,v 1.117 2020/10/19 19:34:18 rillig Exp $        */
+/*     $NetBSD: targ.c,v 1.118 2020/10/19 21:17:35 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.117 2020/10/19 19:34:18 rillig Exp $");
+MAKE_RCSID("$NetBSD: targ.c,v 1.118 2020/10/19 21:17:35 rillig Exp $");
 
 static GNodeList *allTargets;  /* the list of all targets found so far */
 #ifdef CLEANUP
@@ -358,9 +358,9 @@
 void
 Targ_PrintCmds(GNode *gn)
 {
-    StringListNode *node = gn->commands->first;
-    for (; node != NULL; node = node->next) {
-       const char *cmd = LstNode_Datum(node);
+    StringListNode *ln;
+    for (ln = gn->commands->first; ln != NULL; ln = ln->next) {
+       const char *cmd = ln->datum;
        debug_printf("\t%s\n", cmd);
     }
 }



Home | Main Index | Thread Index | Old Index