[macruby-changes] [3494] MacRuby/trunk/string.c

source_changes at macosforge.org source_changes at macosforge.org
Thu Feb 11 14:58:04 PST 2010


Revision: 3494
          http://trac.macosforge.org/projects/ruby/changeset/3494
Author:   neeracher at apple.com
Date:     2010-02-11 14:58:01 -0800 (Thu, 11 Feb 2010)
Log Message:
-----------
make sure -copy can be sent to instances of hidden NSString subclasses (immutable equivalent to r3477)

Revision Links:
--------------
    http://trac.macosforge.org/projects/ruby/changeset/3477

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

Modified: MacRuby/trunk/string.c
===================================================================
--- MacRuby/trunk/string.c	2010-02-11 22:32:23 UTC (rev 3493)
+++ MacRuby/trunk/string.c	2010-02-11 22:58:01 UTC (rev 3494)
@@ -5261,6 +5261,16 @@
 }
 
 static void *
+imp_rb_str_copy(void *rcv, SEL sel)
+{
+    void *dup;
+    PREPARE_RCV(rcv);
+    dup = (void *)objc_msgSend(rcv, selCopy);
+    RESTORE_RCV(rcv);
+    return dup;
+}
+
+static void *
 imp_rb_str_mutableCopy(void *rcv, SEL sel)
 {
     void *dup;
@@ -5285,6 +5295,7 @@
     rb_objc_install_method2(klass, "_fastestEncodingInCFStringEncoding",
 	(IMP)imp_rb_str_fastestEncodingInCFStringEncoding);
     rb_objc_install_method2(klass, "isEqual:", (IMP)imp_rb_str_isEqual);
+    rb_objc_install_method2(klass, "copy", (IMP)imp_rb_str_copy);
     rb_objc_install_method2(klass, "mutableCopy", (IMP)imp_rb_str_mutableCopy);
 
     const bool mutable = class_getSuperclass(klass)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100211/809cc9cf/attachment.html>


More information about the macruby-changes mailing list