[macruby-changes] [134] MacRuby/trunk/hash.c

source_changes at macosforge.org source_changes at macosforge.org
Mon Apr 7 16:03:32 PDT 2008


Revision: 134
          http://trac.macosforge.org/projects/ruby/changeset/134
Author:   lsansonetti at apple.com
Date:     2008-04-07 16:03:31 -0700 (Mon, 07 Apr 2008)

Log Message:
-----------
implement Hash#compare_by_identifier

Modified Paths:
--------------
    MacRuby/trunk/hash.c

Modified: MacRuby/trunk/hash.c
===================================================================
--- MacRuby/trunk/hash.c	2008-04-07 06:30:41 UTC (rev 133)
+++ MacRuby/trunk/hash.c	2008-04-07 23:03:31 UTC (rev 134)
@@ -235,6 +235,10 @@
 }
 
 #if WITH_OBJC
+
+# define HASH_KEY_CALLBACKS(h) \
+  ((CFDictionaryKeyCallBacks *)((uint8_t *)h + 52))
+
 static Boolean 
 rb_cfdictionary_equal_cb(const void *v1, const void *v2)
 {
@@ -2119,8 +2123,7 @@
 {
     rb_hash_modify(hash);
 #if WITH_OBJC
-    /* TODO */
-    rb_notimplement();
+    HASH_KEY_CALLBACKS(hash)->equal = NULL;
 #else
     RHASH(hash)->ntbl->type = &identhash;
     rb_hash_rehash(hash);
@@ -2141,8 +2144,7 @@
 rb_hash_compare_by_id_p(VALUE hash)
 {
 #if WITH_OBJC
-    /* TODO */
-    rb_notimplement();
+    return HASH_KEY_CALLBACKS(hash)->equal == NULL ? Qtrue : Qfalse;
 #else
     if (!RHASH(hash)->ntbl)
         return Qfalse;

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macruby-changes/attachments/20080407/66e54994/attachment.html


More information about the macruby-changes mailing list