diff options
author | jilles <jilles@FreeBSD.org> | 2013-12-05 22:53:32 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2013-12-05 22:53:32 +0000 |
commit | dae0be0fd923ea9f300bc8288153e65348b805fb (patch) | |
tree | 9a470d57f47f74a8ea9e12e263a0061444c6bc67 /bin | |
parent | 8d1c24c247da7da47baf03c222cdb248160e047b (diff) | |
download | FreeBSD-src-dae0be0fd923ea9f300bc8288153e65348b805fb.zip FreeBSD-src-dae0be0fd923ea9f300bc8288153e65348b805fb.tar.gz |
test: Avoid looking up again the type of a known binary operator.
Diffstat (limited to 'bin')
-rw-r--r-- | bin/test/test.c | 13 |
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"); |