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(1): separate ParseGetLine into paragraphs
details: https://anonhg.NetBSD.org/src/rev/8c3025e5900d
branches: trunk
changeset: 957947:8c3025e5900d
user: rillig <rillig%NetBSD.org@localhost>
date: Fri Dec 18 18:23:29 2020 +0000
description:
make(1): separate ParseGetLine into paragraphs
diffstat:
usr.bin/make/parse.c | 41 ++++++++++++++++++++---------------------
1 files changed, 20 insertions(+), 21 deletions(-)
diffs (81 lines):
diff -r bec72bee0ce6 -r 8c3025e5900d usr.bin/make/parse.c
--- a/usr.bin/make/parse.c Fri Dec 18 18:17:45 2020 +0000
+++ b/usr.bin/make/parse.c Fri Dec 18 18:23:29 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.483 2020/12/15 00:32:26 rillig Exp $ */
+/* $NetBSD: parse.c,v 1.484 2020/12/18 18:23:29 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -117,7 +117,7 @@
#include "pathnames.h"
/* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.483 2020/12/15 00:32:26 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.484 2020/12/18 18:23:29 rillig Exp $");
/* types and constants */
@@ -2688,6 +2688,7 @@
ch = '\0';
break;
}
+
ch = *ptr;
if (ch == '\0' ||
(ch == '\\' && ptr + 1 < cf->buf_end &&
@@ -2697,11 +2698,11 @@
return NULL;
}
+ /*
+ * Don't treat next character after '\' as special,
+ * remember first one.
+ */
if (ch == '\\') {
- /*
- * Don't treat next character as special,
- * remember first one.
- */
if (escaped == NULL)
escaped = ptr;
if (ptr[1] == '\n')
@@ -2710,25 +2711,23 @@
line_end = ptr;
continue;
}
- if (ch == '#' && comment == NULL) {
- /*
- * Remember the first '#' for comment
- * stripping, unless the previous char was
- * '[', as in the modifier ':[#]'.
- */
- if (!(ptr > line && ptr[-1] == '['))
- comment = line_end;
- }
+
+ /*
+ * Remember the first '#' for comment stripping,
+ * unless the previous char was '[', as in the
+ * modifier ':[#]'.
+ */
+ if (ch == '#' && comment == NULL &&
+ !(ptr > line && ptr[-1] == '['))
+ comment = line_end;
+
ptr++;
if (ch == '\n')
break;
- if (!ch_isspace(ch)) {
- /*
- * We are not interested in trailing
- * whitespace.
- */
+
+ /* We are not interested in trailing whitespace. */
+ if (!ch_isspace(ch))
line_end = ptr;
- }
}
/* Save next 'to be processed' location */
Home |
Main Index |
Thread Index |
Old Index