summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2016-04-09 21:55:58 +0000
committerjilles <jilles@FreeBSD.org>2016-04-09 21:55:58 +0000
commit86991989093727b0ea1909e2a78cfe75a7663f8f (patch)
tree0c34aab1672a3326eee3e89ef7aa0f3845fbf8fc /bin
parentf631ef3d7880a223e2fd4cebfd3cc95eb4fbc63a (diff)
downloadFreeBSD-src-86991989093727b0ea1909e2a78cfe75a7663f8f.zip
FreeBSD-src-86991989093727b0ea1909e2a78cfe75a7663f8f.tar.gz
MFC r259017: test: Avoid looking up again the type of a known binary
operator.
Diffstat (limited to 'bin')
-rw-r--r--bin/test/test.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/bin/test/test.c b/bin/test/test.c
index 4662d1544..46e9999 100644
--- a/bin/test/test.c
+++ b/bin/test/test.c
@@ -172,7 +172,7 @@ static char **t_wp;
static int parenlevel;
static int aexpr(enum token);
-static int binop(void);
+static int binop(enum token);
static int equalf(const char *, const char *);
static int filstat(char *, enum token);
static int getn(const char *);
@@ -312,21 +312,20 @@ primary(enum token n)
}
}
- if (TOKEN_TYPE(t_lex(nargc > 0 ? t_wp[1] : NULL)) == BINOP)
- return binop();
+ nn = t_lex(nargc > 0 ? t_wp[1] : NULL);
+ if (TOKEN_TYPE(nn) == BINOP)
+ return binop(nn);
return strlen(*t_wp) > 0;
}
static int
-binop(void)
+binop(enum token n)
{
const char *opnd1, *op, *opnd2;
- enum token n;
opnd1 = *t_wp;
- op = nargc > 0 ? t_wp[1] : NULL;
- n = t_lex(nargc > 0 ? (--nargc, *++t_wp) : NULL);
+ op = nargc > 0 ? (--nargc, *++t_wp) : NULL;
if ((opnd2 = nargc > 0 ? (--nargc, *++t_wp) : NULL) == NULL)
syntax(op, "argument expected");
OpenPOWER on IntegriCloud