Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make make: make ParseIsEscape simpler



details:   https://anonhg.NetBSD.org/src/rev/3e089992d644
branches:  trunk
changeset: 1029250:3e089992d644
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Dec 28 16:35:43 2021 +0000

description:
make: make ParseIsEscape simpler

No functional change.

diffstat:

 usr.bin/make/parse.c |  14 +++++---------
 1 files changed, 5 insertions(+), 9 deletions(-)

diffs (38 lines):

diff -r bc586fcbffd8 -r 3e089992d644 usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Tue Dec 28 16:17:54 2021 +0000
+++ b/usr.bin/make/parse.c      Tue Dec 28 16:35:43 2021 +0000
@@ -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 @@
 
 /* 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;
 }
 
 /*



Home | Main Index | Thread Index | Old Index