svn commit: r297767 - stable/10/bin/test
Jilles Tjoelker
jilles at FreeBSD.org
Sat Apr 9 21:56:00 UTC 2016
Author: jilles
Date: Sat Apr 9 21:55:58 2016
New Revision: 297767
URL: https://svnweb.freebsd.org/changeset/base/297767
Log:
MFC r259017: test: Avoid looking up again the type of a known binary
operator.
Modified:
stable/10/bin/test/test.c
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/bin/test/test.c
==============================================================================
--- stable/10/bin/test/test.c Sat Apr 9 21:49:57 2016 (r297766)
+++ stable/10/bin/test/test.c Sat Apr 9 21:55:58 2016 (r297767)
@@ -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");
More information about the svn-src-all
mailing list