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): fix API for Targ_PrintCmd



details:   https://anonhg.NetBSD.org/src/rev/632bae704dda
branches:  trunk
changeset: 954856:632bae704dda
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Sep 12 16:13:48 2020 +0000

description:
make(1): fix API for Targ_PrintCmd

The previous API was too low-level and not strictly typed.

diffstat:

 usr.bin/make/nonints.h |   4 ++--
 usr.bin/make/suff.c    |   8 ++++----
 usr.bin/make/targ.c    |  19 ++++++++++++-------
 3 files changed, 18 insertions(+), 13 deletions(-)

diffs (111 lines):

diff -r 9673281927ce -r 632bae704dda usr.bin/make/nonints.h
--- a/usr.bin/make/nonints.h    Sat Sep 12 15:25:41 2020 +0000
+++ b/usr.bin/make/nonints.h    Sat Sep 12 16:13:48 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nonints.h,v 1.111 2020/09/12 15:21:25 rillig Exp $     */
+/*     $NetBSD: nonints.h,v 1.112 2020/09/12 16:13:48 rillig Exp $     */
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -181,7 +181,7 @@
 Boolean Targ_Silent(GNode *);
 Boolean Targ_Precious(GNode *);
 void Targ_SetMain(GNode *);
-int Targ_PrintCmd(void *, void *);
+void Targ_PrintCmds(GNode *);
 int Targ_PrintNode(void *, void *);
 char *Targ_FmtTime(time_t);
 void Targ_PrintType(int);
diff -r 9673281927ce -r 632bae704dda usr.bin/make/suff.c
--- a/usr.bin/make/suff.c       Sat Sep 12 15:25:41 2020 +0000
+++ b/usr.bin/make/suff.c       Sat Sep 12 16:13:48 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: suff.c,v 1.150 2020/09/12 15:21:25 rillig Exp $        */
+/*     $NetBSD: suff.c,v 1.151 2020/09/12 16:13:48 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: suff.c,v 1.150 2020/09/12 15:21:25 rillig Exp $";
+static char rcsid[] = "$NetBSD: suff.c,v 1.151 2020/09/12 16:13:48 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)suff.c     8.4 (Berkeley) 3/21/94";
 #else
-__RCSID("$NetBSD: suff.c,v 1.150 2020/09/12 15:21:25 rillig Exp $");
+__RCSID("$NetBSD: suff.c,v 1.151 2020/09/12 16:13:48 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -2247,7 +2247,7 @@
     fprintf(debug_file, "%-16s:", t->name);
     Targ_PrintType(t->type);
     fputc('\n', debug_file);
-    Lst_ForEach(t->commands, Targ_PrintCmd, NULL);
+    Targ_PrintCmds(t);
     fputc('\n', debug_file);
     return 0;
 }
diff -r 9673281927ce -r 632bae704dda usr.bin/make/targ.c
--- a/usr.bin/make/targ.c       Sat Sep 12 15:25:41 2020 +0000
+++ b/usr.bin/make/targ.c       Sat Sep 12 16:13:48 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: targ.c,v 1.83 2020/09/05 13:55:08 rillig Exp $ */
+/*     $NetBSD: targ.c,v 1.84 2020/09/12 16:13:48 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: targ.c,v 1.83 2020/09/05 13:55:08 rillig Exp $";
+static char rcsid[] = "$NetBSD: targ.c,v 1.84 2020/09/12 16:13:48 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)targ.c     8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: targ.c,v 1.83 2020/09/05 13:55:08 rillig Exp $");
+__RCSID("$NetBSD: targ.c,v 1.84 2020/09/12 16:13:48 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -379,14 +379,19 @@
     return 0;
 }
 
-
-int
-Targ_PrintCmd(void *cmd, void *dummy MAKE_ATTR_UNUSED)
+static int
+TargPrintCmd(void *cmd, void *dummy MAKE_ATTR_UNUSED)
 {
     fprintf(debug_file, "\t%s\n", (char *)cmd);
     return 0;
 }
 
+void
+Targ_PrintCmds(GNode *gn)
+{
+    Lst_ForEach(gn->commands, TargPrintCmd, NULL);
+}
+
 /* Format a modification time in some reasonable way and return it.
  * The time is placed in a static area, so it is overwritten with each call. */
 char *
@@ -524,7 +529,7 @@
        Targ_PrintType(gn->type);
        Lst_ForEach(gn->children, TargPrintName, NULL);
        fprintf(debug_file, "\n");
-       Lst_ForEach(gn->commands, Targ_PrintCmd, NULL);
+       Targ_PrintCmds(gn);
        fprintf(debug_file, "\n\n");
        if (gn->type & OP_DOUBLEDEP) {
            Lst_ForEach(gn->cohorts, Targ_PrintNode, &pass);



Home | Main Index | Thread Index | Old Index