Revision
141
Author
lsansonetti@apple.com
Date
2008-04-16 12:11:52 -0700 (Wed, 16 Apr 2008)

Log Message

fixing string hashing

Modified Paths

Diff

Modified: MacRuby/trunk/hash.c (140 => 141)


--- MacRuby/trunk/hash.c	2008-04-16 06:47:27 UTC (rev 140)
+++ MacRuby/trunk/hash.c	2008-04-16 19:11:52 UTC (rev 141)
@@ -61,13 +61,14 @@
 	return a != b;
     }
 #if WITH_OBJC
-    if (rb_obj_is_kind_of(a, rb_cString) && rb_obj_is_kind_of(b, rb_cString)) {
+    if (TYPE(a) == T_STRING && TYPE(b) == T_STRING)
+	return rb_str_hash_cmp(a, b);
 #else
     if (TYPE(a) == T_STRING && RBASIC(a)->klass == rb_cString &&
 	TYPE(b) == T_STRING && RBASIC(b)->klass == rb_cString) {
-#endif
 	return rb_str_hash_cmp(a, b);
     }
+#endif
 
     args[0] = a;
     args[1] = b;

Modified: MacRuby/trunk/string.c (140 => 141)


--- MacRuby/trunk/string.c	2008-04-16 06:47:27 UTC (rev 140)
+++ MacRuby/trunk/string.c	2008-04-16 19:11:52 UTC (rev 141)
@@ -2163,7 +2163,7 @@
 int
 rb_str_hash_cmp(VALUE str1, VALUE str2)
 {
-    return CFEqual((CFTypeRef)str1, (CFTypeRef)str2);
+    return CFEqual((CFTypeRef)str1, (CFTypeRef)str2) ? 0 : 1;
 }
 
 #endif