Date: Thu, 5 Dec 2013 22:53:32 +0000 (UTC) From: Jilles Tjoelker <jilles@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r259017 - head/bin/test Message-ID: <201312052253.rB5MrWpe057860@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jilles Date: Thu Dec 5 22:53:32 2013 New Revision: 259017 URL: http://svnweb.freebsd.org/changeset/base/259017 Log: test: Avoid looking up again the type of a known binary operator. Modified: head/bin/test/test.c Modified: head/bin/test/test.c ============================================================================== --- head/bin/test/test.c Thu Dec 5 22:38:53 2013 (r259016) +++ head/bin/test/test.c Thu Dec 5 22:53:32 2013 (r259017) @@ -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");
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201312052253.rB5MrWpe057860>