diff options
author | jilles <jilles@FreeBSD.org> | 2011-11-25 23:45:29 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2011-11-25 23:45:29 +0000 |
commit | 7fab299fc5ccad1582268037c1f5cb8e01cc8001 (patch) | |
tree | 3e682e53196b540c1ab689461860e772e18b5a33 /bin | |
parent | ad5598305fa93ccb3b8a491e9fb2370f94cdf923 (diff) | |
download | FreeBSD-src-7fab299fc5ccad1582268037c1f5cb8e01cc8001.zip FreeBSD-src-7fab299fc5ccad1582268037c1f5cb8e01cc8001.tar.gz |
test: Reduce code size of ops table.
Diffstat (limited to 'bin')
-rw-r--r-- | bin/test/test.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/bin/test/test.c b/bin/test/test.c index 394988e..96aa9f5 100644 --- a/bin/test/test.c +++ b/bin/test/test.c @@ -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++; |