mirror of
https://github.com/ruby/ruby.git
synced 2025-08-28 15:36:16 +02:00
switching hash removal
* st.h (struct st_hash_type): Remove strong_hash. (struct st_table): Remove inside_rebuild_p and curr_hash. * st.c (do_hash): Use type->hash instead of curr_hash. (make_tab_empty): Remove setting up curr_hash. (st_init_table_with_size): Remove setting up inside_rebuild_p. (rebuild_table): Remove clearing inside_rebuild_p. (reset_entry_hashes, HIT_THRESHOULD_FOR_STRONG_HASH): Remove code recognizing a denial attack and switching to strong hash. * hash.c (rb_dbl_long_hash, rb_objid_hash, rb_ident_hash): Use rb_hash_start to randomize the hash. (str_seed): Remove. (any_hash): Remove strong_p and use always rb_str_hash for strings. (any_hash_weak, rb_any_hash_weak): Remove. (st_hash_type objhash): Remove rb_any_hash_weak. based on the patch by Vladimir N Makarov <vmakarov@redhat.com> at [ruby-core:78490]. [Bug #13002] * test/ruby/test_hash.rb (test_wrapper): objects other than special constants should be able to be wrapped. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1e95f9da88
commit
5714a26b90
5 changed files with 46 additions and 98 deletions
|
@ -979,18 +979,6 @@ CODE
|
|||
assert_not_equal(S("sub-setter").hash, S("discover").hash, bug9172)
|
||||
end
|
||||
|
||||
def test_hash_random
|
||||
str = 'abc'
|
||||
a = [str.hash.to_s]
|
||||
3.times {
|
||||
assert_in_out_err(["-e", "print #{str.dump}.hash"], "") do |r, e|
|
||||
a += r
|
||||
assert_equal([], e)
|
||||
end
|
||||
}
|
||||
assert_not_equal([str.hash.to_s], a.uniq)
|
||||
end
|
||||
|
||||
def test_hex
|
||||
assert_equal(255, S("0xff").hex)
|
||||
assert_equal(-255, S("-0xff").hex)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue