Date: Sat, 9 Apr 2016 21:55:59 +0000 (UTC) From: Jilles Tjoelker <jilles@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297767 - stable/10/bin/test Message-ID: <201604092155.u39LtxIr026592@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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");
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201604092155.u39LtxIr026592>