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 ReadMakefileSucceeded into Read...



details:   https://anonhg.NetBSD.org/src/rev/2d8321e369e7
branches:  trunk
changeset: 956840:2d8321e369e7
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Nov 08 12:14:14 2020 +0000

description:
make(1): inline ReadMakefileSucceeded into ReadFirstDefaultMakefile

This gets rid of a few void pointers and an unused function parameter.

diffstat:

 usr.bin/make/main.c |  20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)

diffs (56 lines):

diff -r 0b6f44d7385d -r 2d8321e369e7 usr.bin/make/main.c
--- a/usr.bin/make/main.c       Sun Nov 08 12:02:16 2020 +0000
+++ b/usr.bin/make/main.c       Sun Nov 08 12:14:14 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.445 2020/11/08 12:02:16 rillig Exp $        */
+/*     $NetBSD: main.c,v 1.446 2020/11/08 12:14:14 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "trace.h"
 
 /*     "@(#)main.c     8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: main.c,v 1.445 2020/11/08 12:02:16 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.446 2020/11/08 12:14:14 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
            "The Regents of the University of California.  "
@@ -759,14 +759,6 @@
        return TRUE;
 }
 
-/* Read and parse the makefile.
- * Return TRUE if reading the makefile succeeded. */
-static int
-ReadMakefileSucceeded(void *fname, void *unused)
-{
-       return ReadMakefile(fname) == 0;
-}
-
 int
 str2Lst_Append(StringList *lp, char *str, const char *sep)
 {
@@ -1297,7 +1289,9 @@
 static void
 ReadFirstDefaultMakefile(void)
 {
+       StringListNode *ln;
        char *prefs;
+
        (void)Var_Subst("${" MAKE_MAKEFILE_PREFERENCE "}",
                        VAR_CMDLINE, VARE_WANTRES, &prefs);
        /* TODO: handle errors */
@@ -1307,7 +1301,11 @@
         * also have different semantics in that only the first file that
         * is found is processed.  See ReadAllMakefiles. */
        (void)str2Lst_Append(opts.makefiles, prefs, NULL);
-       (void)Lst_ForEachUntil(opts.makefiles, ReadMakefileSucceeded, NULL);
+
+       for (ln = opts.makefiles->first; ln != NULL; ln = ln->next)
+               if (ReadMakefile(ln->datum) == 0)
+                       break;
+
        free(prefs);
 }
 



Home | Main Index | Thread Index | Old Index