summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-12-25 06:29:27 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-12-25 06:29:27 +0000
commit99020d6e50702eb371111d73280eb80b4b29ba5b (patch)
treef2ec985d66f5d99a203277cf0961d960228d441e /hash.c
parent8f6673c2d4a7e6ff470b584141c590e4b066f5e2 (diff)
001225
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1075 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/hash.c b/hash.c
index 513eeb4347..2a5803c96e 100644
--- a/hash.c
+++ b/hash.c
@@ -59,11 +59,15 @@ rb_any_cmp(a, b)
VALUE a, b;
{
VALUE args[2];
- if (FIXNUM_P(a)) {
- if (FIXNUM_P(b)) return a != b;
+ if (FIXNUM_P(a) && FIXNUM_P(b)) {
+ return a != b;
}
- else if (TYPE(a) == T_STRING) {
- if (TYPE(b) == T_STRING) return rb_str_cmp(a, b);
+ if (TYPE(a) == T_STRING && RBASIC(a)->klass == rb_cString &&
+ TYPE(b) == T_STRING && RBASIC(b)->klass == rb_cString) {
+ return rb_str_cmp(a, b);
+ }
+ if (SYMBOL_P(a) && SYMBOL_P(b)) {
+ return a != b;
}
args[0] = a;
@@ -79,6 +83,7 @@ rb_any_hash(a)
switch (TYPE(a)) {
case T_FIXNUM:
+ case T_SYMBOL:
hval = a;
break;