Module Name:    src
Committed By:   rillig
Date:           Tue Dec 28 16:35:43 UTC 2021

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

Log Message:
make: make ParseIsEscape simpler

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.593 -r1.594 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.593 src/usr.bin/make/parse.c:1.594
--- src/usr.bin/make/parse.c:1.593	Tue Dec 28 16:17:54 2021
+++ src/usr.bin/make/parse.c	Tue Dec 28 16:35:43 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.593 2021/12/28 16:17:54 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.594 2021/12/28 16:35:43 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "pathnames.h"
 
 /*	"@(#)parse.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: parse.c,v 1.593 2021/12/28 16:17:54 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.594 2021/12/28 16:35:43 rillig Exp $");
 
 /* types and constants */
 
@@ -508,16 +508,12 @@ PrintStackTrace(void)
 
 /* Check if the current character is escaped on the current line. */
 static bool
-ParseIsEscaped(const char *line, const char *c)
+ParseIsEscaped(const char *line, const char *p)
 {
 	bool active = false;
-	for (;;) {
-		if (line == c)
-			return active;
-		if (*--c != '\\')
-			return active;
+	while (p > line && *--p == '\\')
 		active = !active;
-	}
+	return active;
 }
 
 /*

Reply via email to