Module Name: src
Committed By: rillig
Date: Mon Sep 14 16:16:52 UTC 2020
Modified Files:
src/usr.bin/make: parse.c
Log Message:
make(1): inline LPAREN in parse.c
It's shorter and more readable, and the other characters don't have
named constants as well.
To generate a diff of this commit:
cvs rdiff -u -r1.309 -r1.310 src/usr.bin/make/parse.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/parse.c
diff -u src/usr.bin/make/parse.c:1.309 src/usr.bin/make/parse.c:1.310
--- src/usr.bin/make/parse.c:1.309 Mon Sep 14 16:12:41 2020
+++ src/usr.bin/make/parse.c Mon Sep 14 16:16:52 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.309 2020/09/14 16:12:41 rillig Exp $ */
+/* $NetBSD: parse.c,v 1.310 2020/09/14 16:16:52 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -131,7 +131,7 @@
#include "pathnames.h"
/* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.309 2020/09/14 16:12:41 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.310 2020/09/14 16:16:52 rillig Exp $");
/* types and constants */
@@ -204,13 +204,6 @@ typedef enum {
Attribute /* Generic attribute */
} ParseSpecial;
-/*
- * Other tokens
- */
-#define LPAREN '('
-#define RPAREN ')'
-
-
/* result data */
/*
@@ -1141,12 +1134,11 @@ ParseDoDependency(char *line)
/* Find the end of the next word. */
for (cp = line; *cp != '\0';) {
- char ch = *cp;
- if ((ch_isspace(ch) || ch == '!' || ch == ':' || ch == LPAREN) &&
+ if ((ch_isspace(*cp) || *cp == '!' || *cp == ':' || *cp == '(') &&
!ParseIsEscaped(lstart, cp))
break;
- if (ch == '$') {
+ if (*cp == '$') {
/*
* Must be a dynamic source (would have been expanded
* otherwise), so call the Var module to parse the puppy
@@ -1171,7 +1163,7 @@ ParseDoDependency(char *line)
* If the word is followed by a left parenthesis, it's the
* name of an object file inside an archive (ar file).
*/
- if (!ParseIsEscaped(lstart, cp) && *cp == LPAREN) {
+ if (!ParseIsEscaped(lstart, cp) && *cp == '(') {
/*
* Archives must be handled specially to make sure the OP_ARCHV
* flag is set in their 'type' field, for one thing, and because
@@ -1634,7 +1626,7 @@ ParseDoDependency(char *line)
* and handle them accordingly.
*/
for (; *cp && !ch_isspace(*cp); cp++) {
- if (*cp == LPAREN && cp > line && cp[-1] != '$') {
+ if (*cp == '(' && cp > line && cp[-1] != '$') {
/*
* Only stop for a left parenthesis if it isn't at the
* start of a word (that'll be for variable changes
@@ -1645,7 +1637,7 @@ ParseDoDependency(char *line)
}
}
- if (*cp == LPAREN) {
+ if (*cp == '(') {
sources = Lst_Init();
if (!Arch_ParseArchive(&line, sources, VAR_CMD)) {
Parse_Error(PARSE_FATAL,