Permalink
Browse files

* 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
  • Loading branch information...
1 parent bc3b4dd commit ca9b0f56fc25a2b98c0646014f5fb352319e8070 @nobu nobu committed Feb 21, 2012
Showing with 10 additions and 14 deletions.
  1. +3 −1 ChangeLog
  2. +7 −13 hash.c
View
@@ -1,4 +1,6 @@
-Tue Feb 21 20:22:43 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Feb 21 20:23:47 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * hash.c (rb_any_hash): treat Qundef like as other special constants.
* hash.c (hash_foreach_iter): fix signature.
View
@@ -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);
}

0 comments on commit ca9b0f5

Please sign in to comment.