[macruby-changes] [1593] MacRuby/branches/experimental/include/ruby/ruby.h

source_changes at macosforge.org source_changes at macosforge.org
Fri May 22 18:47:26 PDT 2009


Revision: 1593
          http://trac.macosforge.org/projects/ruby/changeset/1593
Author:   lsansonetti at apple.com
Date:     2009-05-22 18:47:25 -0700 (Fri, 22 May 2009)
Log Message:
-----------
fixed the _IMMUTABLE macros so that the *IsMutable functions are only called if the object's class is CF

Modified Paths:
--------------
    MacRuby/branches/experimental/include/ruby/ruby.h

Modified: MacRuby/branches/experimental/include/ruby/ruby.h
===================================================================
--- MacRuby/branches/experimental/include/ruby/ruby.h	2009-05-23 00:48:57 UTC (rev 1592)
+++ MacRuby/branches/experimental/include/ruby/ruby.h	2009-05-23 01:47:25 UTC (rev 1593)
@@ -1069,16 +1069,20 @@
 RUBY_EXTERN VALUE rb_cTopLevel;
 
 bool _CFArrayIsMutable(void *);
-#define RARRAY_IMMUTABLE(o) (!_CFArrayIsMutable((void *)o))
+#define RARRAY_IMMUTABLE(o) \
+    (*(VALUE *)o == rb_cCFArray ? !_CFArrayIsMutable((void *)o) : false)
 
 bool _CFDictionaryIsMutable(void *);
-#define RHASH_IMMUTABLE(o) (!_CFDictionaryIsMutable((void *)o))
+#define RHASH_IMMUTABLE(o) \
+    (*(VALUE *)o == rb_cCFHash ? !_CFDictionaryIsMutable((void *)o) : false)
 
 bool __CFStringIsMutable(void *);
-#define RSTRING_IMMUTABLE(o) (!__CFStringIsMutable((void *)o))
+#define RSTRING_IMMUTABLE(o) \
+    (*(VALUE *)o == rb_cCFString ? !__CFStringIsMutable((void *)o) : false)
 
 bool _CFSetIsMutable(void *);
-#define RSET_IMMUTABLE(o) (!_CFSetIsMutable((void *)o))
+#define RSET_IMMUTABLE(o) \
+    (*(VALUE *)o == rb_cCFSet ? !_CFSetIsMutable((void *)o) : false)
 
 #endif
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090522/d6ba4d1a/attachment-0001.html>


More information about the macruby-changes mailing list