summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorYukihiro Matsumoto <[email protected]>2012-05-30 16:12:32 +0900
committerYukihiro Matsumoto <[email protected]>2012-05-30 16:12:32 +0900
commita4a48e3da1e65cdf1e0aaad1f5b4a83d4f91e658 (patch)
tree6714d0d6b13719a149490db9cd7da14c5a2de32f /src
parent0de8ffb0deee9635383a2008b3a95590775ed893 (diff)
downloadmruby-a4a48e3da1e65cdf1e0aaad1f5b4a83d4f91e658.tar.gz
mruby-a4a48e3da1e65cdf1e0aaad1f5b4a83d4f91e658.zip
specify allocating array size for Hash#values
Diffstat (limited to 'src')
-rw-r--r--src/hash.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/hash.c b/src/hash.c
index 19d0507e3..777d5fc1a 100644
--- a/src/hash.c
+++ b/src/hash.c
@@ -1037,7 +1037,7 @@ mrb_hash_values(mrb_state *mrb, mrb_value hash)
{
khash_t(ht) *h = RHASH_TBL(hash);
khiter_t k;
- mrb_value ary = mrb_ary_new(mrb);
+ mrb_value ary = mrb_ary_new_capa(mrb, kh_size(h));
if (!h) return ary;
for (k = kh_begin(h); k != kh_end(h); k++) {