Commit 88f3e5b2 authored by ksss's avatar ksss

move check condition to outside in while block

parent d1526b04
......@@ -185,13 +185,11 @@ ary_expand_capa(mrb_state *mrb, struct RArray *a, mrb_int len)
mrb_raise(mrb, E_ARGUMENT_ERROR, "array size too big");
}
if (capa == 0) {
capa = ARY_DEFAULT_LEN;
}
while (capa < len) {
if (capa == 0) {
capa = ARY_DEFAULT_LEN;
}
else {
capa *= 2;
}
capa *= 2;
}
if (capa > ARY_MAX_SIZE) capa = ARY_MAX_SIZE; /* len <= capa <= ARY_MAX_SIZE */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment