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/hush.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/hush.c')
-rw-r--r-- | shell/hush.c | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/shell/hush.c b/shell/hush.c index ae2876ac7..3e8c387e7 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -1671,24 +1671,6 @@ static void unset_vars(char **strings) | |||
1671 | free(strings); | 1671 | free(strings); |
1672 | } | 1672 | } |
1673 | 1673 | ||
1674 | #if ENABLE_SH_MATH_SUPPORT | ||
1675 | # define is_name(c) ((c) == '_' || isalpha((unsigned char)(c))) | ||
1676 | # define is_in_name(c) ((c) == '_' || isalnum((unsigned char)(c))) | ||
1677 | static char* FAST_FUNC endofname(const char *name) | ||
1678 | { | ||
1679 | char *p; | ||
1680 | |||
1681 | p = (char *) name; | ||
1682 | if (!is_name(*p)) | ||
1683 | return p; | ||
1684 | while (*++p) { | ||
1685 | if (!is_in_name(*p)) | ||
1686 | break; | ||
1687 | } | ||
1688 | return p; | ||
1689 | } | ||
1690 | #endif | ||
1691 | |||
1692 | static void FAST_FUNC set_local_var_from_halves(const char *name, const char *val) | 1674 | static void FAST_FUNC set_local_var_from_halves(const char *name, const char *val) |
1693 | { | 1675 | { |
1694 | char *var = xasprintf("%s=%s", name, val); | 1676 | char *var = xasprintf("%s=%s", name, val); |
@@ -4446,7 +4428,7 @@ static arith_t expand_and_evaluate_arith(const char *arg, int *errcode_p) | |||
4446 | 4428 | ||
4447 | hooks.lookupvar = get_local_var_value; | 4429 | hooks.lookupvar = get_local_var_value; |
4448 | hooks.setvar = set_local_var_from_halves; | 4430 | hooks.setvar = set_local_var_from_halves; |
4449 | hooks.endofname = endofname; | 4431 | //hooks.endofname = endofname; |
4450 | exp_str = expand_pseudo_dquoted(arg); | 4432 | exp_str = expand_pseudo_dquoted(arg); |
4451 | res = arith(exp_str ? exp_str : arg, errcode_p, &hooks); | 4433 | res = arith(exp_str ? exp_str : arg, errcode_p, &hooks); |
4452 | free(exp_str); | 4434 | free(exp_str); |