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

source_changes at macosforge.org source_changes at macosforge.org
Mon Oct 19 16:06:36 PDT 2009


Revision: 2853
          http://trac.macosforge.org/projects/ruby/changeset/2853
Author:   lsansonetti at apple.com
Date:     2009-10-19 16:06:34 -0700 (Mon, 19 Oct 2009)
Log Message:
-----------
String#dup: make sure we honor the receiver's class

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

Modified: MacRuby/trunk/string.c
===================================================================
--- MacRuby/trunk/string.c	2009-10-19 22:52:16 UTC (rev 2852)
+++ MacRuby/trunk/string.c	2009-10-19 23:06:34 UTC (rev 2853)
@@ -326,17 +326,16 @@
 {
     VALUE dup;
 
-#if 1
     if (*(VALUE *)str == rb_cByteString) {
 	dup = rb_bytestring_copy(str);
     }
     else {
 	dup = (VALUE)CFStringCreateMutableCopy(NULL, 0, (CFStringRef)str);
 	CFMakeCollectable((CFTypeRef)dup);
+	if (*(VALUE *)str != rb_cSymbol) {
+	    *(VALUE *)dup = *(VALUE *)str;
+	}
     }
-#else
-    dup = (VALUE)objc_msgSend((id)str, selMutableCopy);
-#endif
 
     if (OBJ_TAINTED(str)) {
 	OBJ_TAINT(dup);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20091019/8e6c8c0b/attachment-0001.html>


More information about the macruby-changes mailing list