* st.c (unpack_entries): reallocate bins if packed array size
is not same as initial bins size. based on a patch by Sokolov Yura <funny.falcon AT gmail.com>. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34900 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
697b53d8a9
commit
e5ac15998d
@ -1,3 +1,9 @@
|
|||||||
|
Mon Mar 5 12:43:43 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* st.c (unpack_entries): reallocate bins if packed array size
|
||||||
|
is not same as initial bins size. based on a patch by
|
||||||
|
Sokolov Yura <funny.falcon AT gmail.com>.
|
||||||
|
|
||||||
Mon Mar 5 11:51:48 2012 NARUSE, Yui <naruse@ruby-lang.org>
|
Mon Mar 5 11:51:48 2012 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
* ext/bigdecimal/lib/bigdecimal/math.rb: remove description about
|
* ext/bigdecimal/lib/bigdecimal/math.rb: remove description about
|
||||||
|
5
st.c
5
st.c
@ -478,7 +478,12 @@ unpack_entries(register st_table *table)
|
|||||||
table->bins = (st_table_entry **)&packed_bins;
|
table->bins = (st_table_entry **)&packed_bins;
|
||||||
tmp_table.entries_packed = 0;
|
tmp_table.entries_packed = 0;
|
||||||
tmp_table.num_entries = 0;
|
tmp_table.num_entries = 0;
|
||||||
|
#if ST_DEFAULT_INIT_TABLE_SIZE == ST_DEFAULT_PACKED_TABLE_SIZE
|
||||||
MEMZERO(tmp_table.bins, st_table_entry*, tmp_table.num_bins);
|
MEMZERO(tmp_table.bins, st_table_entry*, tmp_table.num_bins);
|
||||||
|
#else
|
||||||
|
tmp_table.bins = st_realloc_bins(tmp_table.bins, ST_DEFAULT_INIT_TABLE_SIZE, tmp_table.num_bins);
|
||||||
|
tmp_table.num_bins = ST_DEFAULT_INIT_TABLE_SIZE;
|
||||||
|
#endif
|
||||||
for (i = 0; i < table->num_entries; i++) {
|
for (i = 0; i < table->num_entries; i++) {
|
||||||
/* packed table should be numhash */
|
/* packed table should be numhash */
|
||||||
st_index_t key = PKEY(table, i), value = PVAL(table, i);
|
st_index_t key = PKEY(table, i), value = PVAL(table, i);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user