mirror of
https://github.com/ruby/ruby.git
synced 2025-09-16 00:54:01 +02:00
id_table.c: extend, don't shrink
* id_table.c (hash_table_extend): should not shrink the table than the previous capacity. [ruby-core:76534] [Bug #12614] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6418594993
commit
dfe1d4fda6
2 changed files with 8 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Sun Aug 14 22:35:40 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* id_table.c (hash_table_extend): should not shrink the table than
|
||||||
|
the previous capacity. [ruby-core:76534] [Bug #12614]
|
||||||
|
|
||||||
Sun Aug 14 18:51:24 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Sun Aug 14 18:51:24 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* gems/bundled_gems: add gemified tk 0.1.0.
|
* gems/bundled_gems: add gemified tk 0.1.0.
|
||||||
|
|
|
@ -1311,6 +1311,9 @@ hash_table_extend(struct hash_id_table* tbl)
|
||||||
int i;
|
int i;
|
||||||
item_t* old;
|
item_t* old;
|
||||||
struct hash_id_table tmp_tbl = {0, 0, 0};
|
struct hash_id_table tmp_tbl = {0, 0, 0};
|
||||||
|
if (new_cap < tbl->capa) {
|
||||||
|
new_cap = round_capa(tbl->used + (tbl->used >> 1));
|
||||||
|
}
|
||||||
tmp_tbl.capa = new_cap;
|
tmp_tbl.capa = new_cap;
|
||||||
tmp_tbl.items = ZALLOC_N(item_t, new_cap);
|
tmp_tbl.items = ZALLOC_N(item_t, new_cap);
|
||||||
for (i = 0; i < tbl->capa; i++) {
|
for (i = 0; i < tbl->capa; i++) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue