Module Name:    src
Committed By:   rillig
Date:           Mon Sep 14 15:11:13 UTC 2020

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

Log Message:
make(1): split confusing condition in ParseDoDependency

A while loop is easier to understand than a do-while loop.

An if statement of the form if-something-then-do-something is easier to
understand than if-complicated-condition-then-continue-doing-something.


To generate a diff of this commit:
cvs rdiff -u -r1.306 -r1.307 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.306 src/usr.bin/make/parse.c:1.307
--- src/usr.bin/make/parse.c:1.306	Mon Sep 14 14:58:27 2020
+++ src/usr.bin/make/parse.c	Mon Sep 14 15:11:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.306 2020/09/14 14:58:27 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.307 2020/09/14 15:11:13 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -131,7 +131,7 @@
 #include "pathnames.h"
 
 /*	"@(#)parse.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: parse.c,v 1.306 2020/09/14 14:58:27 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.307 2020/09/14 15:11:13 rillig Exp $");
 
 /* types and constants */
 
@@ -1133,7 +1133,7 @@ ParseDoDependency(char *line)
      * First, grind through the targets.
      */
 
-    do {
+    while (TRUE) {
 	/*
 	 * Here LINE points to the beginning of the next word, and
 	 * LSTART points to the actual beginning of the line.
@@ -1413,8 +1413,11 @@ ParseDoDependency(char *line)
 	    }
 	}
 	line = cp;
-    } while (*line && (ParseIsEscaped(lstart, line) ||
-	(*line != '!' && *line != ':')));
+	if (*line == '\0')
+	    break;
+	if ((*line == '!' || *line == ':') && !ParseIsEscaped(lstart, line))
+	    break;
+    }
 
     /*
      * Don't need the list of target names anymore...

Reply via email to