Module Name: src
Committed By: rillig
Date: Sat Aug 29 07:05:12 UTC 2020
Modified Files:
src/usr.bin/make: main.c
Log Message:
make(1): rename confusing function ReadAllMakefiles
The old name implied that the function would read multiple files, which
was not the case.
The comment above that function was highly confusing. It's not that the
function returns a boolean, but rather 0 or non-zero, and 0 means that
Lst_Find should stop searching.
One of the next refactorings will be to make Lst_Find return the first
list node for which the function returns TRUE. This will reduce the
confusion about the several functions called SomethingP in suff.c. The
P suffix means to return TRUE or FALSE, not 0 or non-zero.
To generate a diff of this commit:
cvs rdiff -u -r1.320 -r1.321 src/usr.bin/make/main.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/main.c
diff -u src/usr.bin/make/main.c:1.320 src/usr.bin/make/main.c:1.321
--- src/usr.bin/make/main.c:1.320 Fri Aug 28 04:48:57 2020
+++ src/usr.bin/make/main.c Sat Aug 29 07:05:12 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.320 2020/08/28 04:48:57 rillig Exp $ */
+/* $NetBSD: main.c,v 1.321 2020/08/29 07:05:12 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.320 2020/08/28 04:48:57 rillig Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.321 2020/08/29 07:05:12 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
@@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
#if 0
static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94";
#else
-__RCSID("$NetBSD: main.c,v 1.320 2020/08/28 04:48:57 rillig Exp $");
+__RCSID("$NetBSD: main.c,v 1.321 2020/08/29 07:05:12 rillig Exp $");
#endif
#endif /* not lint */
#endif
@@ -785,15 +785,9 @@ Main_SetVarObjdir(const char *var, const
return TRUE;
}
-/*-
- * ReadAllMakefiles --
- * wrapper around ReadMakefile() to read all.
- *
- * Results:
- * TRUE if ok, FALSE on error
- */
+/* Return 0 if reading the makefile failed, for Lst_Find. */
static int
-ReadAllMakefiles(const void *p, const void *q)
+ReadMakefileFailed(const void *p, const void *q)
{
return ReadMakefile(p, q) == 0;
}
@@ -1339,7 +1333,7 @@ main(int argc, char **argv)
if (!Lst_IsEmpty(makefiles)) {
LstNode ln;
- ln = Lst_Find(makefiles, ReadAllMakefiles, NULL);
+ ln = Lst_Find(makefiles, ReadMakefileFailed, NULL);
if (ln != NULL)
Fatal("%s: cannot open %s.", progname,
(char *)Lst_Datum(ln));
@@ -1497,15 +1491,10 @@ main(int argc, char **argv)
return outOfDate ? 1 : 0;
}
-/*-
- * ReadMakefile --
- * Open and parse the given makefile.
+/* Open and parse the given makefile, with all its side effects.
*
* Results:
* 0 if ok. -1 if couldn't open file.
- *
- * Side Effects:
- * lots
*/
static int
ReadMakefile(const void *p, const void *q MAKE_ATTR_UNUSED)