1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* st.c (unpack_entries): Fix r34310: on unpacking, the position of

a hash must be do_hash-ed value.

* st.c (add_packed_direct): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34319 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2012-01-16 22:38:05 +00:00
parent de1e4881d4
commit 84f204046b
2 changed files with 10 additions and 2 deletions

View file

@ -1,3 +1,10 @@
Tue Jan 17 07:30:12 2012 NARUSE, Yui <naruse@ruby-lang.org>
* st.c (unpack_entries): Fix r34310: on unpacking, the position of
a hash must be do_hash-ed value.
* st.c (add_packed_direct): ditto.
Mon Jan 16 16:41:53 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/optparse.rb (Regexp): fix incorrect options when casting to

5
st.c
View file

@ -462,7 +462,7 @@ unpack_entries(register st_table *table)
tmp_table.num_entries = 0;
memset(tmp_table.bins, 0, sizeof(struct st_table_entry *) * tmp_table.num_bins);
for (i = 0; i < table->num_entries; i++) {
st_index_t hash_val = PKEY(table, i); /* do_hash(PKEY(table, i), &tmp_table); */
st_index_t hash_val = do_hash(PKEY(table, i), &tmp_table);
add_direct(&tmp_table, PKEY(table, i), PVAL(table, i),
hash_val, hash_val % tmp_table.num_bins);
}
@ -478,8 +478,9 @@ add_packed_direct(st_table *table, st_data_t key, st_data_t value)
PVAL_SET(table, i, value);
}
else {
st_index_t hash_val = do_hash(key, table);
unpack_entries(table);
add_direct(table, key, value, key, key % table->num_bins);
add_direct(table, key, value, hash_val, hash_val % table->num_bins);
}
}