[Python-checkins] r71542 - python/branches/py3k-short-float-repr/Objects/stringlib/formatter.h

eric.smith python-checkins at python.org
Mon Apr 13 00:57:40 CEST 2009


Author: eric.smith
Date: Mon Apr 13 00:57:40 2009
New Revision: 71542

Log:
Replaced nested if's with a switch statement.

Modified:
   python/branches/py3k-short-float-repr/Objects/stringlib/formatter.h

Modified: python/branches/py3k-short-float-repr/Objects/stringlib/formatter.h
==============================================================================
--- python/branches/py3k-short-float-repr/Objects/stringlib/formatter.h	(original)
+++ python/branches/py3k-short-float-repr/Objects/stringlib/formatter.h	Mon Apr 13 00:57:40 2009
@@ -362,17 +362,18 @@
     */
 
     /* compute the various parts we're going to write */
-    if (format->sign == '+') {
+    switch (format->sign) {
+    case '+':
         /* always put a + or - */
         spec->n_sign = 1;
         spec->sign = (sign_char == '-' ? '-' : '+');
-    }
-    else if (format->sign == ' ') {
+        break;
+    case ' ':
         spec->n_sign = 1;
         spec->sign = (sign_char == '-' ? '-' : ' ');
-    }
-    else {
-        /* non specified, or the default (-) */
+        break;
+    default:
+        /* Not specified, or the default (-) */
         if (sign_char == '-') {
             spec->n_sign = 1;
             spec->sign = '-';


More information about the Python-checkins mailing list