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
path: root/shell
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2023-06-14 02:05:40 +0300
committerDenys Vlasenko <vda.linux@googlemail.com>2023-06-14 02:05:40 +0300
commita02450ff0bfa45618e72fc7103ea3a8f0e7fff80 (patch)
treed70679fc7ee75274780359ac7bc4873efa581fe8 /shell
parent8acbf31708779e7ad559775c9db4ebd7a962be33 (diff)
shell/math: remove a redundant check
function old new delta arith_apply 1134 1087 -47 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell')
-rw-r--r--shell/math.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/shell/math.c b/shell/math.c
index d5f3ce361..9ca7c6bb1 100644
--- a/shell/math.c
+++ b/shell/math.c
@@ -435,10 +435,11 @@ arith_apply(arith_state_t *math_state, operator op, var_or_num_t *numstack, var_
c *= rez;
rez = c;
}
- else if (right_side_val == 0)
- return "divide by zero";
- else if (op == TOK_DIV || op == TOK_DIV_ASSIGN
- || op == TOK_REM || op == TOK_REM_ASSIGN) {
+ else /*if (op == TOK_DIV || op == TOK_DIV_ASSIGN
+ || op == TOK_REM || op == TOK_REM_ASSIGN) - always true */
+ {
+ if (right_side_val == 0)
+ return "divide by zero";
/*
* bash 4.2.45 x86 64bit: SEGV on 'echo $((2**63 / -1))'
*
@@ -456,9 +457,8 @@ arith_apply(arith_state_t *math_state, operator op, var_or_num_t *numstack, var_
}
if (op == TOK_DIV || op == TOK_DIV_ASSIGN)
rez /= right_side_val;
- else {
+ else
rez %= right_side_val;
- }
}
}