diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2023-06-14 01:05:40 +0200 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2023-06-14 01:05:40 +0200 |
| commit | a02450ff0bfa45618e72fc7103ea3a8f0e7fff80 (patch) | |
| tree | d70679fc7ee75274780359ac7bc4873efa581fe8 /shell | |
| parent | 8acbf31708779e7ad559775c9db4ebd7a962be33 (diff) | |
| download | busybox-w32-a02450ff0bfa45618e72fc7103ea3a8f0e7fff80.tar.gz busybox-w32-a02450ff0bfa45618e72fc7103ea3a8f0e7fff80.tar.bz2 busybox-w32-a02450ff0bfa45618e72fc7103ea3a8f0e7fff80.zip | |
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.c | 12 |
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_ | |||
| 435 | c *= rez; | 435 | c *= rez; |
| 436 | rez = c; | 436 | rez = c; |
| 437 | } | 437 | } |
| 438 | else if (right_side_val == 0) | 438 | else /*if (op == TOK_DIV || op == TOK_DIV_ASSIGN |
| 439 | return "divide by zero"; | 439 | || op == TOK_REM || op == TOK_REM_ASSIGN) - always true */ |
| 440 | else if (op == TOK_DIV || op == TOK_DIV_ASSIGN | 440 | { |
| 441 | || op == TOK_REM || op == TOK_REM_ASSIGN) { | 441 | if (right_side_val == 0) |
| 442 | return "divide by zero"; | ||
| 442 | /* | 443 | /* |
| 443 | * bash 4.2.45 x86 64bit: SEGV on 'echo $((2**63 / -1))' | 444 | * bash 4.2.45 x86 64bit: SEGV on 'echo $((2**63 / -1))' |
| 444 | * | 445 | * |
| @@ -456,9 +457,8 @@ arith_apply(arith_state_t *math_state, operator op, var_or_num_t *numstack, var_ | |||
| 456 | } | 457 | } |
| 457 | if (op == TOK_DIV || op == TOK_DIV_ASSIGN) | 458 | if (op == TOK_DIV || op == TOK_DIV_ASSIGN) |
| 458 | rez /= right_side_val; | 459 | rez /= right_side_val; |
| 459 | else { | 460 | else |
| 460 | rez %= right_side_val; | 461 | rez %= right_side_val; |
| 461 | } | ||
| 462 | } | 462 | } |
| 463 | } | 463 | } |
| 464 | 464 | ||
