diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-12-18 02:07:31 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-12-18 02:07:31 +0000 |
commit | 125514995cb83f18464f4b17a7272fe19099e939 (patch) | |
tree | d5e534cd272b29ac61a098ec492515cbf230383b /hash.c | |
parent | 7836e8ade3444b7c43259138bff5db4bc40986e2 (diff) |
* dir.c (dir_open_dir): new function. [ruby-dev:25242]
* hash.c (Init_Hash): remove custom "hash" and "eql?".
* lib/set.rb (Set::eql): wrong definition. [ruby-dev:25207]
* object.c (rb_obj_id_obsolete): warn always.
* eval.c (rb_enable_super): ditto.
* lib/set.rb (Set#==): [ruby-dev:25206]
* lib/pstore.rb (PStore#transaction): Use the empty content when a
file is not found. [ruby-dev:24561]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7592 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
-rw-r--r-- | hash.c | 61 |
1 files changed, 0 insertions, 61 deletions
@@ -1503,65 +1503,6 @@ rb_hash_equal(hash1, hash2) return hash_equal(hash1, hash2, Qfalse); } -/* - * call-seq: - * hsh.eql?(other_hash) => true or false - * - * Returns true if two hashes are equal, i.e they have same key-value set, - * and same default values. - * - */ - -static VALUE -rb_hash_eql(hash1, hash2) - VALUE hash1, hash2; -{ - return hash_equal(hash1, hash2, Qtrue); -} - - -rb_hash_hash_i(key, value, hp) - VALUE key, value; - long *hp; -{ - long h = *hp; - VALUE n; - - h = (h << 1) | (h<0 ? 1 : 0); - n = rb_hash(key); - h ^= NUM2LONG(n); - h = (h << 1) | (h<0 ? 1 : 0); - n = rb_hash(value); - h ^= NUM2LONG(n); - - *hp = h; - return ST_CONTINUE; -} - -/* - * call-seq: - * hash.hash -> fixnum - * - * Compute a hash-code for this hash. Two hashes with the same content - * will have the same hash code (and will compare using <code>eql?</code>). - */ - -static VALUE -rb_hash_hash(hash) - VALUE hash; -{ - long h; - VALUE n; - - h = RHASH(hash)->tbl->num_entries; - rb_hash_foreach(hash, rb_hash_hash_i, (VALUE)&h); - h = (h << 1) | (h<0 ? 1 : 0); - n = rb_hash(RHASH(hash)->ifnone); - h ^= NUM2LONG(n); - - return LONG2FIX(h); -} - static int rb_hash_invert_i(key, value, hash) VALUE key, value; @@ -2496,8 +2437,6 @@ Init_Hash() rb_define_method(rb_cHash,"inspect", rb_hash_inspect, 0); rb_define_method(rb_cHash,"==", rb_hash_equal, 1); - rb_define_method(rb_cHash,"eql?", rb_hash_eql, 1); - rb_define_method(rb_cHash,"hash", rb_hash_hash, 0); rb_define_method(rb_cHash,"[]", rb_hash_aref, 1); rb_define_method(rb_cHash,"fetch", rb_hash_fetch, -1); rb_define_method(rb_cHash,"[]=", rb_hash_aset, 2); |