From owner-svn-src-head@FreeBSD.ORG Fri Nov 25 23:45:29 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B9682106564A; Fri, 25 Nov 2011 23:45:29 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A99D28FC08; Fri, 25 Nov 2011 23:45:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAPNjTqi064300; Fri, 25 Nov 2011 23:45:29 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAPNjTGJ064298; Fri, 25 Nov 2011 23:45:29 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201111252345.pAPNjTGJ064298@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 25 Nov 2011 23:45:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227984 - head/bin/test X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Nov 2011 23:45:29 -0000 Author: jilles Date: Fri Nov 25 23:45:29 2011 New Revision: 227984 URL: http://svn.freebsd.org/changeset/base/227984 Log: test: Reduce code size of ops table. Modified: head/bin/test/test.c Modified: head/bin/test/test.c ============================================================================== --- head/bin/test/test.c Fri Nov 25 20:59:04 2011 (r227983) +++ head/bin/test/test.c Fri Nov 25 23:45:29 2011 (r227984) @@ -119,7 +119,7 @@ enum token_types { }; static struct t_op { - const char *op_text; + char op_text[4]; short op_num, op_type; } const ops [] = { {"-r", FILRD, UNOP}, @@ -162,7 +162,7 @@ static struct t_op { {"-o", BOR, BBINOP}, {"(", LPAREN, PAREN}, {")", RPAREN, PAREN}, - {0, 0, 0} + {"", 0, 0} }; static struct t_op const *t_wp_op; @@ -427,7 +427,7 @@ t_lex(char *s) t_wp_op = NULL; return EOI; } - while (op->op_text) { + while (*op->op_text) { if (strcmp(s, op->op_text) == 0) { if (((op->op_type == UNOP || op->op_type == BUNOP) && isunopoperand()) || @@ -456,7 +456,7 @@ isunopoperand(void) if (nargc == 2) return parenlevel == 1 && strcmp(s, ")") == 0; t = *(t_wp + 2); - while (op->op_text) { + while (*op->op_text) { if (strcmp(s, op->op_text) == 0) return op->op_type == BINOP && (parenlevel == 0 || t[0] != ')' || t[1] != '\0'); @@ -478,7 +478,7 @@ islparenoperand(void) return parenlevel == 1 && strcmp(s, ")") == 0; if (nargc != 3) return 0; - while (op->op_text) { + while (*op->op_text) { if (strcmp(s, op->op_text) == 0) return op->op_type == BINOP; op++;