Module Name: src
Committed By: rillig
Date: Mon Sep 14 16:12:41 UTC 2020
Modified Files:
src/usr.bin/make: parse.c
Log Message:
make(1): flip conditions in ParseDoDependency
In the usual case where the character is a letter or another ordinary
character, each of the terminal conditions has to be evaluated,
therefore from the compiler's view the order doesn't matter. For
humans, "a unless b" is easier to grasp and more common than "not b but
a", therefore switch to the common pattern.
To generate a diff of this commit:
cvs rdiff -u -r1.308 -r1.309 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.308 src/usr.bin/make/parse.c:1.309
--- src/usr.bin/make/parse.c:1.308 Mon Sep 14 16:05:09 2020
+++ src/usr.bin/make/parse.c Mon Sep 14 16:12:41 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.308 2020/09/14 16:05:09 rillig Exp $ */
+/* $NetBSD: parse.c,v 1.309 2020/09/14 16:12:41 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.308 2020/09/14 16:05:09 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.309 2020/09/14 16:12:41 rillig Exp $");
/* types and constants */
@@ -1141,11 +1141,12 @@ ParseDoDependency(char *line)
/* Find the end of the next word. */
for (cp = line; *cp != '\0';) {
- if (!ParseIsEscaped(lstart, cp) &&
- (ch_isspace(*cp) || *cp == '!' || *cp == ':' || *cp == LPAREN))
+ char ch = *cp;
+ if ((ch_isspace(ch) || ch == '!' || ch == ':' || ch == LPAREN) &&
+ !ParseIsEscaped(lstart, cp))
break;
- if (*cp == '$') {
+ if (ch == '$') {
/*
* Must be a dynamic source (would have been expanded
* otherwise), so call the Var module to parse the puppy