From 03dad22f8a1b8b1410fdcccf69af1bb5cce4de7c Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Tue, 12 Jan 2010 23:29:57 +0100 Subject: 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 --- shell/ash.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'shell/ash.c') diff --git a/shell/ash.c b/shell/ash.c index c7deffd08..31dc59253 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, -- cgit v1.2.3