Module Name:    src
Committed By:   rillig
Date:           Sat Jan  8 21:28:59 UTC 2022

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

Log Message:
make: return early from SkipIrrelevantBranches

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.639 -r1.640 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.639 src/usr.bin/make/parse.c:1.640
--- src/usr.bin/make/parse.c:1.639	Sat Jan  8 20:21:34 2022
+++ src/usr.bin/make/parse.c	Sat Jan  8 21:28:59 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.639 2022/01/08 20:21:34 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.640 2022/01/08 21:28:59 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.639 2022/01/08 20:21:34 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.640 2022/01/08 21:28:59 rillig Exp $");
 
 /*
  * A file being read.
@@ -2428,7 +2428,10 @@ typedef enum LineKind {
 	LK_DOT
 } LineKind;
 
-/* Return the next "interesting" logical line from the current file. */
+/*
+ * Return the next "interesting" logical line from the current file.  The
+ * returned string will be freed at the end of including the file.
+ */
 static char *
 ReadLowLevelLine(LineKind kind)
 {
@@ -2475,27 +2478,26 @@ ReadLowLevelLine(LineKind kind)
 static bool
 SkipIrrelevantBranches(void)
 {
-	char *line;
+	const char *line;
 
 	while ((line = ReadLowLevelLine(LK_DOT)) != NULL) {
 		if (Cond_EvalLine(line) == CR_TRUE)
-			break;
+			return true;
 		/*
-		 * TODO: Check for typos in .elif directives
-		 * such as .elsif or .elseif.
+		 * TODO: Check for typos in .elif directives such as .elsif
+		 * or .elseif.
 		 *
-		 * This check will probably duplicate some of
-		 * the code in ParseLine.  Most of the code
-		 * there cannot apply, only ParseVarassign and
-		 * ParseDependencyLine can, and to prevent code
-		 * duplication, these would need to be called
-		 * with a flag called onlyCheckSyntax.
+		 * This check will probably duplicate some of the code in
+		 * ParseLine.  Most of the code there cannot apply, only
+		 * ParseVarassign and ParseDependencyLine can, and to prevent
+		 * code duplication, these would need to be called with a
+		 * flag called onlyCheckSyntax.
 		 *
 		 * See directive-elif.mk for details.
 		 */
 	}
 
-	return line != NULL;
+	return false;
 }
 
 static bool

Reply via email to