aboutsummaryrefslogtreecommitdiffstats
path: root/hash.c
diff options
context:
space:
mode:
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/hash.c b/hash.c
index fa323a1f4e..dfc54f0bb9 100644
--- a/hash.c
+++ b/hash.c
@@ -692,6 +692,9 @@ rb_hash_s_create(int argc, VALUE *argv, VALUE klass)
}
hash = hash_alloc(klass);
+ if (argc > 0) {
+ RHASH(hash)->ntbl = st_init_table_with_size(&objhash, argc / 2);
+ }
for (i=0; i<argc; i+=2) {
rb_hash_aset(hash, argv[i], argv[i + 1]);
}