Commit 30ac4e55 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge pull request #1758 from ksss/array-out-while

move check condition to outside in while block
parents ed079741 88f3e5b2
......@@ -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