зеркало из https://github.com/github/ruby.git
* 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
This commit is contained in:
Родитель
bc3b4ddddd
Коммит
ca9b0f56fc
|
@ -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.
|
||||
|
||||
|
|
20
hash.c
20
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);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче