Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2023-06-14 12:10:45 +0300
committerDenys Vlasenko <vda.linux@googlemail.com>2023-06-14 12:10:45 +0300
commit5febdb122357dbe39e236c9e93d06dab328edb45 (patch)
tree1ee7a0811c9fa07031479af1f7ae8abb4d403bcf
parent46dccd2ec0eafd850b2168d4dfe4e74949fd3424 (diff)
shell/math: remove now-unused second_val
function old new delta arith_apply 1137 1134 -3 evaluate_string 1101 1095 -6 arith_lookup_val 150 143 -7 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-16) Total: -16 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--shell/math.c23
1 files changed, 3 insertions, 20 deletions
diff --git a/shell/math.c b/shell/math.c
index 2b7a3494f..fa22bc400 100644
--- a/shell/math.c
+++ b/shell/math.c
@@ -246,24 +246,11 @@ is_right_associative(operator prec)
typedef struct {
arith_t val;
- /* We acquire second_val only when "expr1 : expr2" part
- * of ternary ?: op is evaluated.
- * We treat ?: as two binary ops: (expr ? (expr1 : expr2)).
- * ':' produces a new value which has two parts, val and second_val;
- * then '?' selects one of them based on its left side.
- */
- arith_t second_val;
-#define SECOND_VAL_VALID ((char*)(intptr_t)-1)
- /* If NULL then it's just a number, if SECOND_VAL_VALID,
- * it's a result of "expr : expr", else it's a named variable.
- * (We use SECOND_VAL_VALID instead of a bit flag to keep
- * var_or_num_t smaller, we allocate a lot of them on stack).
- */
char *var_name;
} var_or_num_t;
-#define VALID_NAME(name) ((name) && (name) != SECOND_VAL_VALID)
-#define NOT_NAME(name) (!(name) || (name) == SECOND_VAL_VALID)
+#define VALID_NAME(name) (name)
+#define NOT_NAME(name) (!(name))
typedef struct remembered_name {
@@ -854,11 +841,7 @@ evaluate_string(arith_state_t *math_state, const char *expr)
errmsg = arith_apply(math_state, prev_op, numstack, &numstackptr);
if (errmsg)
goto err_with_custom_msg;
-dbg(" numstack:%d val:%lld %lld %p", (int)(numstackptr - numstack),
- numstackptr[-1].val,
- numstackptr[-1].var_name == SECOND_VAL_VALID ? numstackptr[-1].second_val : 0,
- numstackptr[-1].var_name
-);
+dbg(" numstack:%d val:%lld '%s'", (int)(numstackptr - numstack), numstackptr[-1].val, numstackptr[-1].var_name);
/* For ternary ?: we need to remove ? from opstack too, not just : */
if (prev_op == TOK_CONDITIONAL_SEP) {
// This is caught in arith_apply()