hash.c: init table with size
* hash.c (rb_hash_s_create): allocate internal table with the given size. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c15acbba04
commit
2f6821a7c4
3
hash.c
3
hash.c
@ -692,6 +692,9 @@ rb_hash_s_create(int argc, VALUE *argv, VALUE klass)
|
|||||||
}
|
}
|
||||||
|
|
||||||
hash = hash_alloc(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) {
|
for (i=0; i<argc; i+=2) {
|
||||||
rb_hash_aset(hash, argv[i], argv[i + 1]);
|
rb_hash_aset(hash, argv[i], argv[i + 1]);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user