diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-07-01 18:33:35 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-07-01 18:33:35 +0000 |
commit | c6753c1666d11391da56ebd5a2048af07f3bc9be (patch) | |
tree | c7003532d5297e24cf9b776dac1de0ecf3197ac2 | |
parent | 679b41237ccbcb78b53df85eb9e95754158d62af (diff) | |
download | busybox-w32-c6753c1666d11391da56ebd5a2048af07f3bc9be.tar.gz busybox-w32-c6753c1666d11391da56ebd5a2048af07f3bc9be.tar.bz2 busybox-w32-c6753c1666d11391da56ebd5a2048af07f3bc9be.zip |
expr: small code shrink
-rw-r--r-- | coreutils/expr.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/coreutils/expr.c b/coreutils/expr.c index 46e18d190..ab182a804 100644 --- a/coreutils/expr.c +++ b/coreutils/expr.c | |||
@@ -277,12 +277,15 @@ static VALUE *eval7(void) | |||
277 | 277 | ||
278 | static VALUE *eval6(void) | 278 | static VALUE *eval6(void) |
279 | { | 279 | { |
280 | VALUE *l, *r, *v = NULL /* silence gcc */, *i1, *i2; | ||
281 | static const char * const keywords[] = { | 280 | static const char * const keywords[] = { |
282 | "quote", "length", "match", "index", "substr", NULL | 281 | "quote", "length", "match", "index", "substr", NULL |
283 | }; | 282 | }; |
284 | 283 | ||
285 | smalluint key = *G.args ? index_in_str_array(keywords, *G.args) + 1 : 0; | 284 | VALUE *r, *i1, *i2; |
285 | VALUE *l = l; /* silence gcc */ | ||
286 | VALUE *v = v; /* silence gcc */ | ||
287 | int key = *G.args ? index_in_str_array(keywords, *G.args) + 1 : 0; | ||
288 | |||
286 | if (key == 0) /* not a keyword */ | 289 | if (key == 0) /* not a keyword */ |
287 | return eval7(); | 290 | return eval7(); |
288 | G.args++; /* We have a valid token, so get the next argument. */ | 291 | G.args++; /* We have a valid token, so get the next argument. */ |
@@ -320,8 +323,8 @@ static VALUE *eval6(void) | |||
320 | i2 = eval6(); | 323 | i2 = eval6(); |
321 | tostring(l); | 324 | tostring(l); |
322 | if (!toarith(i1) || !toarith(i2) | 325 | if (!toarith(i1) || !toarith(i2) |
323 | || i1->u.i > (arith_t) strlen(l->u.s) | 326 | || i1->u.i > (arith_t) strlen(l->u.s) |
324 | || i1->u.i <= 0 || i2->u.i <= 0) | 327 | || i1->u.i <= 0 || i2->u.i <= 0) |
325 | v = str_value(""); | 328 | v = str_value(""); |
326 | else { | 329 | else { |
327 | v = xmalloc(sizeof(VALUE)); | 330 | v = xmalloc(sizeof(VALUE)); |