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: clean up ValidShortVarname
details: https://anonhg.NetBSD.org/src/rev/1870664729eb
branches: trunk
changeset: 980675:1870664729eb
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Feb 14 18:59:36 2021 +0000
description:
make: clean up ValidShortVarname
The switch statement was hard to read, especially the "break" that
needed a comment since it was effectively a "continue".
diffstat:
usr.bin/make/var.c | 15 ++++-----------
1 files changed, 4 insertions(+), 11 deletions(-)
diffs (37 lines):
diff -r c5b9363ad866 -r 1870664729eb usr.bin/make/var.c
--- a/usr.bin/make/var.c Sun Feb 14 18:55:51 2021 +0000
+++ b/usr.bin/make/var.c Sun Feb 14 18:59:36 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.817 2021/02/14 18:55:51 rillig Exp $ */
+/* $NetBSD: var.c,v 1.818 2021/02/14 18:59:36 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -139,7 +139,7 @@
#include "metachar.h"
/* "@(#)var.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.817 2021/02/14 18:55:51 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.818 2021/02/14 18:59:36 rillig Exp $");
typedef enum VarFlags {
VAR_NONE = 0,
@@ -3894,16 +3894,9 @@
static VarParseResult
ValidShortVarname(char varname, const char *start)
{
- switch (varname) {
- case '\0':
- case ')':
- case '}':
- case ':':
- case '$':
- break; /* and continue below */
- default:
+ if (varname != '$' && varname != ':' && varname != '}' &&
+ varname != ')' && varname != '\0')
return VPR_OK;
- }
if (!opts.strict)
return VPR_ERR; /* XXX: Missing error message */
Home |
Main Index |
Thread Index |
Old Index