[macruby-changes] [4478] MacRuby/trunk/sprintf.c

source_changes at macosforge.org source_changes at macosforge.org
Mon Aug 30 13:52:55 PDT 2010


Revision: 4478
          http://trac.macosforge.org/projects/ruby/changeset/4478
Author:   lsansonetti at apple.com
Date:     2010-08-30 13:52:55 -0700 (Mon, 30 Aug 2010)
Log Message:
-----------
#sprintf: don't try to mutate symbols

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

Modified: MacRuby/trunk/sprintf.c
===================================================================
--- MacRuby/trunk/sprintf.c	2010-08-30 20:52:28 UTC (rev 4477)
+++ MacRuby/trunk/sprintf.c	2010-08-30 20:52:55 UTC (rev 4478)
@@ -794,6 +794,11 @@
 		tainted = true;
 	    }
 
+	    if (TYPE(arg) == T_SYMBOL) {
+		// Because symbols are not mutable and pad_format_value()
+		// mutates its first argument.
+		arg = rb_sym_to_s(arg);
+	    }
 	    pad_format_value(arg, minus_flag ? -1 : 0, width, rb_str_new2(" "));
 	    num = cstr_update(&format_str, &format_str_capa, start,
 		    i - start + 1, arg);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100830/8148eaf4/attachment.html>


More information about the macruby-changes mailing list