← Commit list

d6e24bd79

Denys Vlasenko
Denys Vlasenko
2018-12-18
SUCCESS Duration: 152s

Subject

bc: simplify bc_array_expand()

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

miscutils/bc.c+9 -7
@@ -2547,17 +2547,19 @@ static void bc_array_init(BcVec *a, bool nums)
static void bc_array_expand(BcVec *a, size_t len)
{
- BcResultData data;
-
- if (a->size == sizeof(BcNum) && a->dtor == bc_num_free) {
+ if (a->dtor == bc_num_free
+ // && a->size == sizeof(BcNum) - always true
+ ) {
+ BcNum n;
while (len > a->len) {
- bc_num_init_DEF_SIZE(&data.n);
- bc_vec_push(a, &data.n);
+ bc_num_init_DEF_SIZE(&n);
+ bc_vec_push(a, &n);
}
} else {
+ BcVec v;
while (len > a->len) {
- bc_array_init(&data.v, true);
- bc_vec_push(a, &data.v);
+ bc_array_init(&v, true);
+ bc_vec_push(a, &v);
}
}
}