ruby-changes:22271
From: naruse <ko1@a...>
Date: Tue, 17 Jan 2012 07:38:31 +0900 (JST)
Subject: [ruby-changes:22271] naruse:r34319 (trunk): * st.c (unpack_entries): Fix r34310: on unpacking, the position of
naruse 2012-01-17 07:38:05 +0900 (Tue, 17 Jan 2012) New Revision: 34319 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=34319 Log: * 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. Modified files: trunk/ChangeLog trunk/st.c Index: ChangeLog =================================================================== --- ChangeLog (revision 34318) +++ ChangeLog (revision 34319) @@ -1,3 +1,10 @@ +Tue Jan 17 07:30:12 2012 NARUSE, Yui <naruse@r...> + + * 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@r...> * lib/optparse.rb (Regexp): fix incorrect options when casting to Index: st.c =================================================================== --- st.c (revision 34318) +++ st.c (revision 34319) @@ -462,7 +462,7 @@ 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 @@ 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); } } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/