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/math.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'shell/math.c') diff --git a/shell/math.c b/shell/math.c index 76159b299..91fb28f05 100644 --- a/shell/math.c +++ b/shell/math.c @@ -25,14 +25,6 @@ * * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. */ -#include "libbb.h" -#include "math.h" - -#define a_e_h_t arith_eval_hooks_t -#define lookupvar (math_hooks->lookupvar) -#define setvar (math_hooks->setvar) -#define endofname (math_hooks->endofname) - /* Copyright (c) 2001 Aaron Lehmann Permission is hereby granted, free of charge, to any person obtaining @@ -99,7 +91,6 @@ * whitespace chars should be considered. Look below the "#include"s for a * precompiler test. */ - /* * Aug 26, 2001 Manuel Novoa III * @@ -109,7 +100,6 @@ * modified slightly to take account of my changes to the code. * */ - /* * (C) 2003 Vladimir Oleynik * @@ -126,6 +116,13 @@ * - protect $((num num)) as true zero expr (Manuel`s error) * - always use special isspace(), see comment from bash ;-) */ +#include "libbb.h" +#include "math.h" + +#define a_e_h_t arith_eval_hooks_t +#define lookupvar (math_hooks->lookupvar) +#define setvar (math_hooks->setvar ) +#define endofname (math_hooks->endofname) #define arith_isspace(arithval) \ (arithval == ' ' || arithval == '\n' || arithval == '\t') @@ -420,7 +417,7 @@ arith_apply(operator op, v_n_t *numstack, v_n_t **numstackptr, a_e_h_t *math_hoo } /* save to shell variable */ sprintf(buf, arith_t_fmt, rez); - setvar(numptr_m1->var, buf, 0); + setvar(numptr_m1->var, buf); /* after saving, make previous value for v++ or v-- */ if (op == TOK_POST_INC) rez--; -- cgit v1.2.3