Revision
4478
Author
lsansonetti@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

Diff

Modified: MacRuby/trunk/sprintf.c (4477 => 4478)


--- 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);