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): eliminate macro from VarGetPattern
details: https://anonhg.NetBSD.org/src/rev/e3da8925eb70
branches: trunk
changeset: 936123:e3da8925eb70
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Jul 19 15:47:10 2020 +0000
description:
make(1): eliminate macro from VarGetPattern
diffstat:
usr.bin/make/var.c | 14 ++++++--------
1 files changed, 6 insertions(+), 8 deletions(-)
diffs (48 lines):
diff -r da44789a6282 -r e3da8925eb70 usr.bin/make/var.c
--- a/usr.bin/make/var.c Sun Jul 19 15:42:25 2020 +0000
+++ b/usr.bin/make/var.c Sun Jul 19 15:47:10 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.262 2020/07/19 14:05:39 rillig Exp $ */
+/* $NetBSD: var.c,v 1.263 2020/07/19 15:47:10 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.262 2020/07/19 14:05:39 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.263 2020/07/19 15:47:10 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94";
#else
-__RCSID("$NetBSD: var.c,v 1.262 2020/07/19 14:05:39 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.263 2020/07/19 15:47:10 rillig Exp $");
#endif
#endif /* not lint */
#endif
@@ -2060,10 +2060,6 @@
if (length == NULL)
length = &junk;
-#define IS_A_MATCH(cp, delim) \
- ((cp[0] == '\\') && ((cp[1] == delim) || \
- (cp[1] == '\\') || (cp[1] == '$') || (pattern && (cp[1] == '&'))))
-
/*
* Skim through until the matching delimiter is found;
* pick up variable substitutions on the way. Also allow
@@ -2071,7 +2067,9 @@
* touch other backslashes.
*/
for (cp = *tstr; *cp && (*cp != delim); cp++) {
- if (IS_A_MATCH(cp, delim)) {
+ Boolean is_escaped = cp[0] == '\\' && (cp[1] == delim ||
+ cp[1] == '\\' || cp[1] == '$' || (pattern && cp[1] == '&'));
+ if (is_escaped) {
Buf_AddByte(&buf, cp[1]);
cp++;
} else if (*cp == '$') {
Home |
Main Index |
Thread Index |
Old Index