diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2018-12-18 20:10:48 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2018-12-18 20:10:48 +0100 |
commit | d6e24bd795d5d1d00c2414efe2e5d9e1152c5f5b (patch) | |
tree | 6b5b52814dffba45b6c3fd6e19bf50fab55b6798 /miscutils | |
parent | 30a8e0c2f9006db75840724ce89883595dfc7379 (diff) | |
download | busybox-w32-d6e24bd795d5d1d00c2414efe2e5d9e1152c5f5b.tar.gz busybox-w32-d6e24bd795d5d1d00c2414efe2e5d9e1152c5f5b.tar.bz2 busybox-w32-d6e24bd795d5d1d00c2414efe2e5d9e1152c5f5b.zip |
bc: simplify bc_array_expand()
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'miscutils')
-rw-r--r-- | miscutils/bc.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c index e62ca0f69..7ddae341f 100644 --- a/miscutils/bc.c +++ b/miscutils/bc.c | |||
@@ -2547,17 +2547,19 @@ static void bc_array_init(BcVec *a, bool nums) | |||
2547 | 2547 | ||
2548 | static void bc_array_expand(BcVec *a, size_t len) | 2548 | static void bc_array_expand(BcVec *a, size_t len) |
2549 | { | 2549 | { |
2550 | BcResultData data; | 2550 | if (a->dtor == bc_num_free |
2551 | 2551 | // && a->size == sizeof(BcNum) - always true | |
2552 | if (a->size == sizeof(BcNum) && a->dtor == bc_num_free) { | 2552 | ) { |
2553 | BcNum n; | ||
2553 | while (len > a->len) { | 2554 | while (len > a->len) { |
2554 | bc_num_init_DEF_SIZE(&data.n); | 2555 | bc_num_init_DEF_SIZE(&n); |
2555 | bc_vec_push(a, &data.n); | 2556 | bc_vec_push(a, &n); |
2556 | } | 2557 | } |
2557 | } else { | 2558 | } else { |
2559 | BcVec v; | ||
2558 | while (len > a->len) { | 2560 | while (len > a->len) { |
2559 | bc_array_init(&data.v, true); | 2561 | bc_array_init(&v, true); |
2560 | bc_vec_push(a, &data.v); | 2562 | bc_vec_push(a, &v); |
2561 | } | 2563 | } |
2562 | } | 2564 | } |
2563 | } | 2565 | } |