[Python-checkins] cpython (2.7): fix indentation and add braces

benjamin.peterson python-checkins at python.org
Mon Mar 31 01:16:56 CEST 2014


http://hg.python.org/cpython/rev/79dad8ec1805
changeset:   90054:79dad8ec1805
branch:      2.7
parent:      90051:a720f0a312de
user:        Benjamin Peterson <benjamin at python.org>
date:        Sun Mar 30 19:16:44 2014 -0400
summary:
  fix indentation and add braces

files:
  Objects/stringobject.c |  35 +++++++++++++++--------------
  1 files changed, 18 insertions(+), 17 deletions(-)


diff --git a/Objects/stringobject.c b/Objects/stringobject.c
--- a/Objects/stringobject.c
+++ b/Objects/stringobject.c
@@ -3091,24 +3091,25 @@
     i = 0; /* chars up to and including most recent \n or \r */
     j = 0; /* chars since most recent \n or \r (use in tab calculations) */
     e = PyString_AS_STRING(self) + PyString_GET_SIZE(self); /* end of input */
-    for (p = PyString_AS_STRING(self); p < e; p++)
-    if (*p == '\t') {
-        if (tabsize > 0) {
-            incr = tabsize - (j % tabsize);
-            if (j > PY_SSIZE_T_MAX - incr)
+    for (p = PyString_AS_STRING(self); p < e; p++) {
+        if (*p == '\t') {
+            if (tabsize > 0) {
+                incr = tabsize - (j % tabsize);
+                if (j > PY_SSIZE_T_MAX - incr)
+                    goto overflow1;
+                j += incr;
+            }
+        }
+        else {
+            if (j > PY_SSIZE_T_MAX - 1)
                 goto overflow1;
-            j += incr;
-        }
-    }
-    else {
-        if (j > PY_SSIZE_T_MAX - 1)
-            goto overflow1;
-        j++;
-        if (*p == '\n' || *p == '\r') {
-            if (i > PY_SSIZE_T_MAX - j)
-                goto overflow1;
-            i += j;
-            j = 0;
+            j++;
+            if (*p == '\n' || *p == '\r') {
+                if (i > PY_SSIZE_T_MAX - j)
+                    goto overflow1;
+                i += j;
+                j = 0;
+            }
         }
     }
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list