summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-21 11:23:50 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-21 11:23:50 +0000
commitca9b0f56fc25a2b98c0646014f5fb352319e8070 (patch)
treee24499016fd655c3ade828c313a905487c378db2 /hash.c
parentbc3b4ddddd686e380c921c0f33213ddb61a2a0b4 (diff)
* 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.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/hash.c b/hash.c
index 4959a2c1bc..b908950bb9 100644
--- a/hash.c
+++ b/hash.c
@@ -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);
}