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

source_changes at macosforge.org source_changes at macosforge.org
Mon Nov 22 06:14:15 PST 2010


Revision: 4929
          http://trac.macosforge.org/projects/ruby/changeset/4929
Author:   watson1978 at gmail.com
Date:     2010-11-22 06:14:11 -0800 (Mon, 22 Nov 2010)
Log Message:
-----------
modified the style of r4928.

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

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

Modified: MacRuby/trunk/sprintf.c
===================================================================
--- MacRuby/trunk/sprintf.c	2010-11-22 09:09:20 UTC (rev 4928)
+++ MacRuby/trunk/sprintf.c	2010-11-22 14:14:11 UTC (rev 4929)
@@ -715,24 +715,30 @@
 		    complete = true;
 		    break;
 
-		default:
-		    if (format_str[i - 1] == '%' &&
-			(format_str[i] == '\0' || format_str[i] == '\n')) {
+		case '\n':
+		case '\0':
+		    if (format_str[i - 1] == '%') {
 			if (format_str[i] == '\n') {
 			    arg = rb_str_new("%\n", 2);
 			}
-			else if (format_len > i) {
-			    arg = rb_str_new("%\0", 2);
-			}
 			else {
-			    arg = rb_str_new("%", 1);
+			    if (format_len > i) {
+				arg = rb_str_new("%\0", 2);
+			    }
+			    else {
+				arg = rb_str_new("%", 1);
+			    }
 			}
 			complete = true;
+			break;
 		    }
-		    else {
-			rb_raise(rb_eArgError, "malformed format string - %%%c",
-				 format_str[i]);
-		    }
+		    rb_raise(rb_eArgError, "malformed format string - %%%c",
+			     format_str[i]);
+		    break;
+
+		default:
+		    rb_raise(rb_eArgError, "malformed format string - %%%c",
+			     format_str[i]);
 	    }
 	    if (!complete) {
 		continue;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20101122/518be118/attachment.html>


More information about the macruby-changes mailing list