Module Name:    src
Committed By:   rillig
Date:           Fri Jan  7 08:48:16 UTC 2022

Modified Files:
        src/usr.bin/make: parse.c

Log Message:
make: clean up nitpicks in parse.c

In PrintLocation, fname is not an iterator, so prefer fname[0] over
*fname.

List stdout and stderr in this order, for consistency with main.c.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.621 -r1.622 src/usr.bin/make/parse.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/parse.c
diff -u src/usr.bin/make/parse.c:1.621 src/usr.bin/make/parse.c:1.622
--- src/usr.bin/make/parse.c:1.621	Fri Jan  7 08:37:23 2022
+++ src/usr.bin/make/parse.c	Fri Jan  7 08:48:16 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.621 2022/01/07 08:37:23 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.622 2022/01/07 08:48:16 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -106,7 +106,7 @@
 #include "pathnames.h"
 
 /*	"@(#)parse.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: parse.c,v 1.621 2022/01/07 08:37:23 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.622 2022/01/07 08:48:16 rillig Exp $");
 
 /*
  * Structure for a file being read ("included file")
@@ -427,16 +427,11 @@ PrintLocation(FILE *f, const char *fname
 	char dirbuf[MAXPATHLEN + 1];
 	FStr dir, base;
 
-	if (*fname == '/' || strcmp(fname, "(stdin)") == 0) {
+	if (fname[0] == '/' || strcmp(fname, "(stdin)") == 0) {
 		(void)fprintf(f, "\"%s\" line %u: ", fname, (unsigned)lineno);
 		return;
 	}
 
-	/*
-	 * Find out which makefile is the culprit. We try ${.PARSEDIR} and
-	 * apply realpath(3) if not absolute.
-	 */
-
 	dir = Var_Value(SCOPE_GLOBAL, ".PARSEDIR");
 	if (dir.str == NULL)
 		dir.str = ".";
@@ -494,7 +489,7 @@ ParseErrorInternal(const char *fname, si
 	ParseVErrorInternal(stderr, fname, lineno, type, fmt, ap);
 	va_end(ap);
 
-	if (opts.debug_file != stderr && opts.debug_file != stdout) {
+	if (opts.debug_file != stdout && opts.debug_file != stderr) {
 		va_start(ap, fmt);
 		ParseVErrorInternal(opts.debug_file, fname, lineno, type,
 		    fmt, ap);
@@ -531,7 +526,7 @@ Parse_Error(ParseErrorLevel type, const 
 	ParseVErrorInternal(stderr, fname, lineno, type, fmt, ap);
 	va_end(ap);
 
-	if (opts.debug_file != stderr && opts.debug_file != stdout) {
+	if (opts.debug_file != stdout && opts.debug_file != stderr) {
 		va_start(ap, fmt);
 		ParseVErrorInternal(opts.debug_file, fname, lineno, type,
 		    fmt, ap);
@@ -1182,7 +1177,7 @@ AddToPaths(const char *dir, SearchPathLi
  * a something and deal with it accordingly.
  */
 static void
-ParseDependencySourceSpecial(ParseSpecial special, char *word,
+ParseDependencySourceSpecial(ParseSpecial special, const char *word,
 			     SearchPathList *paths)
 {
 	switch (special) {

Reply via email to