aboutsummaryrefslogtreecommitdiff
path: root/shell/hush.c
diff options
context:
space:
mode:
authorDenys Vlasenko <dvlasenk@redhat.com>2010-09-13 12:49:03 +0200
committerDenys Vlasenko <dvlasenk@redhat.com>2010-09-13 12:49:03 +0200
commit06d44d7dfb709bfe02e74d187cceb8591bbda3b4 (patch)
tree9a2a8e8381cecae29a5c02ed10995d0a0ad9d412 /shell/hush.c
parentbd14770b0c8594ce5b0ab9b0b1249b72fc781dd3 (diff)
downloadbusybox-w32-06d44d7dfb709bfe02e74d187cceb8591bbda3b4.tar.gz
busybox-w32-06d44d7dfb709bfe02e74d187cceb8591bbda3b4.tar.bz2
busybox-w32-06d44d7dfb709bfe02e74d187cceb8591bbda3b4.zip
shell/math.c: rename arith_eval_hooks to arith_state, put error code into it
function old new delta expand_and_evaluate_arith 79 89 +10 arith 675 674 -1 arith_lookup_val 151 142 -9 ash_arith 135 122 -13 arith_apply 1304 1269 -35 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/4 up/down: 10/-58) Total: -48 bytes Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'shell/hush.c')
-rw-r--r--shell/hush.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/shell/hush.c b/shell/hush.c
index ef0c454ec..4ca5403de 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -4463,15 +4463,16 @@ static char *encode_then_expand_string(const char *str, int process_bkslash, int
4463#if ENABLE_SH_MATH_SUPPORT 4463#if ENABLE_SH_MATH_SUPPORT
4464static arith_t expand_and_evaluate_arith(const char *arg, int *errcode_p) 4464static arith_t expand_and_evaluate_arith(const char *arg, int *errcode_p)
4465{ 4465{
4466 arith_eval_hooks_t hooks; 4466 arith_state_t math_state;
4467 arith_t res; 4467 arith_t res;
4468 char *exp_str; 4468 char *exp_str;
4469 4469
4470 hooks.lookupvar = get_local_var_value; 4470 math_state.lookupvar = get_local_var_value;
4471 hooks.setvar = set_local_var_from_halves; 4471 math_state.setvar = set_local_var_from_halves;
4472 //hooks.endofname = endofname; 4472 //math_state.endofname = endofname;
4473 exp_str = encode_then_expand_string(arg, /*process_bkslash:*/ 1, /*unbackslash:*/ 1); 4473 exp_str = encode_then_expand_string(arg, /*process_bkslash:*/ 1, /*unbackslash:*/ 1);
4474 res = arith(exp_str ? exp_str : arg, errcode_p, &hooks); 4474 res = arith(&math_state, exp_str ? exp_str : arg);
4475 *errcode_p = math_state.errcode;
4475 free(exp_str); 4476 free(exp_str);
4476 return res; 4477 return res;
4477} 4478}