diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-02-21 11:23:50 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-02-21 11:23:50 +0000 |
commit | ca9b0f56fc25a2b98c0646014f5fb352319e8070 (patch) | |
tree | e24499016fd655c3ade828c313a905487c378db2 /hash.c | |
parent | bc3b4ddddd686e380c921c0f33213ddb61a2a0b4 (diff) | |
download | ruby-ca9b0f56fc25a2b98c0646014f5fb352319e8070.tar.gz |
* hash.c (rb_any_hash): treat Qundef like as other special constants.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
-rw-r--r-- | hash.c | 20 |
1 files changed, 7 insertions, 13 deletions
@@ -80,20 +80,14 @@ rb_any_hash(VALUE a) VALUE hval; st_index_t hnum; - switch (TYPE(a)) { - case T_FIXNUM: - case T_SYMBOL: - case T_NIL: - case T_FALSE: - case T_TRUE: - hnum = rb_hash_end(rb_hash_start((unsigned int)a)); - break; - - case T_STRING: + if (SPECIAL_CONST_P(a)) { + if (a == Qundef) return 0; + hnum = rb_hash_end(rb_hash_start((st_index_t)a)); + } + else if (BUILTIN_TYPE(a) == T_STRING) { hnum = rb_str_hash(a); - break; - - default: + } + else { hval = rb_hash(a); hnum = FIX2LONG(hval); } |