aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--miscutils/bc.c16
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
2548static void bc_array_expand(BcVec *a, size_t len) 2548static 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}