summaryrefslogtreecommitdiff
path: root/shell/hush.c
diff options
context:
space:
mode:
authorDenys Vlasenko2010-09-13 12:49:03 +0200
committerDenys Vlasenko2010-09-13 12:49:03 +0200
commit06d44d7dfb709bfe02e74d187cceb8591bbda3b4 (patch)
tree9a2a8e8381cecae29a5c02ed10995d0a0ad9d412 /shell/hush.c
parentbd14770b0c8594ce5b0ab9b0b1249b72fc781dd3 (diff)
downloadbusybox-06d44d7dfb709bfe02e74d187cceb8591bbda3b4.zip
busybox-06d44d7dfb709bfe02e74d187cceb8591bbda3b4.tar.gz
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 ef0c454..4ca5403 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
#if ENABLE_SH_MATH_SUPPORT
static arith_t expand_and_evaluate_arith(const char *arg, int *errcode_p)
{
- arith_eval_hooks_t hooks;
+ arith_state_t math_state;
arith_t res;
char *exp_str;
- hooks.lookupvar = get_local_var_value;
- hooks.setvar = set_local_var_from_halves;
- //hooks.endofname = endofname;
+ math_state.lookupvar = get_local_var_value;
+ math_state.setvar = set_local_var_from_halves;
+ //math_state.endofname = endofname;
exp_str = encode_then_expand_string(arg, /*process_bkslash:*/ 1, /*unbackslash:*/ 1);
- res = arith(exp_str ? exp_str : arg, errcode_p, &hooks);
+ res = arith(&math_state, exp_str ? exp_str : arg);
+ *errcode_p = math_state.errcode;
free(exp_str);
return res;
}