Module Name: src
Committed By: rillig
Date: Sun Feb 14 18:59:36 UTC 2021
Modified Files:
src/usr.bin/make: var.c
Log Message:
make: clean up ValidShortVarname
The switch statement was hard to read, especially the "break" that
needed a comment since it was effectively a "continue".
To generate a diff of this commit:
cvs rdiff -u -r1.817 -r1.818 src/usr.bin/make/var.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/var.c
diff -u src/usr.bin/make/var.c:1.817 src/usr.bin/make/var.c:1.818
--- src/usr.bin/make/var.c:1.817 Sun Feb 14 18:55:51 2021
+++ src/usr.bin/make/var.c Sun Feb 14 18:59:36 2021
@@ -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 @@ ParseVarname(const char **pp, char start
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 */