diff options
author | Denys Vlasenko | 2010-01-12 23:29:57 +0100 |
---|---|---|
committer | Denys Vlasenko | 2010-01-12 23:29:57 +0100 |
commit | 03dad22f8a1b8b1410fdcccf69af1bb5cce4de7c (patch) | |
tree | b134cbc7f0afbf76c54847624310e6a1d2774f83 /shell/ash.c | |
parent | 045f4ad92c07434625e168bc8c37aa0e89f6e58e (diff) | |
download | busybox-03dad22f8a1b8b1410fdcccf69af1bb5cce4de7c.zip busybox-03dad22f8a1b8b1410fdcccf69af1bb5cce4de7c.tar.gz |
hush: use ash's read builtin
function old new delta
shell_builtin_read - 1000 +1000
set_local_var_from_halves - 24 +24
setvar2 - 7 +7
...
popstring 140 134 -6
ash_main 1375 1368 -7
setvar 184 174 -10
arith_set_local_var 36 - -36
builtin_read 1096 185 -911
------------------------------------------------------------------------------
(add/remove: 3/1 grow/shrink: 5/23 up/down: 1038/-1007) Total: 31 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/ash.c')
-rw-r--r-- | shell/ash.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/shell/ash.c b/shell/ash.c index c7deffd..31dc592 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -1884,7 +1884,7 @@ getoptsreset(const char *value) * Return of a legal variable name (a letter or underscore followed by zero or * more letters, underscores, and digits). */ -static char * +static char* FAST_FUNC endofname(const char *name) { char *p; @@ -1991,7 +1991,7 @@ findvar(struct var **vpp, const char *name) /* * Find the value of a variable. Returns NULL if not set. */ -static const char * +static const char* FAST_FUNC lookupvar(const char *name) { struct var *v; @@ -2114,6 +2114,12 @@ setvar(const char *name, const char *val, int flags) INT_ON; } +static void FAST_FUNC +setvar2(const char *name, const char *val) +{ + setvar(name, val, 0); +} + #if ENABLE_ASH_GETOPTS /* * Safe version of setvar, returns 1 on success 0 on failure. @@ -5304,7 +5310,7 @@ ash_arith(const char *s) int errcode = 0; math_hooks.lookupvar = lookupvar; - math_hooks.setvar = setvar; + math_hooks.setvar = setvar2; math_hooks.endofname = endofname; INT_OFF; @@ -12526,7 +12532,7 @@ readcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) } } - r = builtin_read(setvar, + r = shell_builtin_read(setvar2, argptr, bltinlookup("IFS"), /* can be NULL */ read_flags, |