diff options
| author | Denys Vlasenko <dvlasenk@redhat.com> | 2010-09-07 12:19:33 +0200 |
|---|---|---|
| committer | Denys Vlasenko <dvlasenk@redhat.com> | 2010-09-07 12:19:33 +0200 |
| commit | 8b2f13d84def87b4ebd0901bf0c3157bc1f6dee3 (patch) | |
| tree | 0bf072d3612c77dd8b0720973e46e8dbc37a040a /shell/math.c | |
| parent | 27c56f12670295286a881bbb87d506f0a5bfd40e (diff) | |
| download | busybox-w32-8b2f13d84def87b4ebd0901bf0c3157bc1f6dee3.tar.gz busybox-w32-8b2f13d84def87b4ebd0901bf0c3157bc1f6dee3.tar.bz2 busybox-w32-8b2f13d84def87b4ebd0901bf0c3157bc1f6dee3.zip | |
shell: unify endofname() in hush and ash
function old new delta
builtin_umask 132 133 +1
changepath 195 194 -1
expand_and_evaluate_arith 77 69 -8
ash_arith 143 135 -8
expand_one_var 1551 1515 -36
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/4 up/down: 1/-53) Total: -52 bytes
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'shell/math.c')
| -rw-r--r-- | shell/math.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/shell/math.c b/shell/math.c index f0cc2e35d..a4c55a4d0 100644 --- a/shell/math.c +++ b/shell/math.c | |||
| @@ -122,7 +122,7 @@ | |||
| 122 | #define a_e_h_t arith_eval_hooks_t | 122 | #define a_e_h_t arith_eval_hooks_t |
| 123 | #define lookupvar (math_hooks->lookupvar) | 123 | #define lookupvar (math_hooks->lookupvar) |
| 124 | #define setvar (math_hooks->setvar ) | 124 | #define setvar (math_hooks->setvar ) |
| 125 | #define endofname (math_hooks->endofname) | 125 | //#define endofname (math_hooks->endofname) |
| 126 | 126 | ||
| 127 | #define arith_isspace(arithval) \ | 127 | #define arith_isspace(arithval) \ |
| 128 | (arithval == ' ' || arithval == '\n' || arithval == '\t') | 128 | (arithval == ' ' || arithval == '\n' || arithval == '\t') |
| @@ -479,6 +479,18 @@ static const char op_tokens[] ALIGN1 = { | |||
| 479 | /* ptr to ")" */ | 479 | /* ptr to ")" */ |
| 480 | #define endexpression (&op_tokens[sizeof(op_tokens)-7]) | 480 | #define endexpression (&op_tokens[sizeof(op_tokens)-7]) |
| 481 | 481 | ||
| 482 | const char* FAST_FUNC | ||
| 483 | endofname(const char *name) | ||
| 484 | { | ||
| 485 | if (!is_name(*name)) | ||
| 486 | return name; | ||
| 487 | while (*++name) { | ||
| 488 | if (!is_in_name(*name)) | ||
| 489 | break; | ||
| 490 | } | ||
| 491 | return name; | ||
| 492 | } | ||
| 493 | |||
| 482 | arith_t | 494 | arith_t |
| 483 | arith(const char *expr, int *perrcode, a_e_h_t *math_hooks) | 495 | arith(const char *expr, int *perrcode, a_e_h_t *math_hooks) |
| 484 | { | 496 | { |
