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

source_changes at macosforge.org source_changes at macosforge.org
Wed Aug 12 21:31:17 PDT 2009


Revision: 2303
          http://trac.macosforge.org/projects/ruby/changeset/2303
Author:   lsansonetti at apple.com
Date:     2009-08-12 21:31:17 -0700 (Wed, 12 Aug 2009)
Log Message:
-----------
String#inspect: fixed escaping of single and double quotes

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

Modified: MacRuby/trunk/string.c
===================================================================
--- MacRuby/trunk/string.c	2009-08-13 04:20:20 UTC (rev 2302)
+++ MacRuby/trunk/string.c	2009-08-13 04:31:17 UTC (rev 2303)
@@ -2515,11 +2515,13 @@
     for (i = 0; i < len; i++) {
 	UniChar c = CFStringGetCharacterFromInlineBuffer(&buf, i);
 	if (iswprint(c)) {
-	    __append(out, c);
+	    if (c == '"'|| c == '\\') {
+		__append_escape(out, c);
+	    }
+	    else {
+		__append(out, c);
+	    }
 	}
-	else if (c == '"'|| c == '\\') {
-	    __append_escape(out, c);
-	}
 	else if (c == '\n') {
 	    __append_escape(out, 'n');
 	}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090812/2fbb2f19/attachment-0001.html>


More information about the macruby-changes mailing list