add braces and fix indentation

This commit is contained in:
Benjamin Peterson 2014-03-30 19:23:24 -04:00
parent 0e431b9311
commit 8312eccd34
1 changed files with 18 additions and 17 deletions

View File

@ -3125,25 +3125,26 @@ string_expandtabs(PyStringObject *self, PyObject *args)
q = PyString_AS_STRING(u); /* next output char */
qe = PyString_AS_STRING(u) + PyString_GET_SIZE(u); /* end of output */
for (p = PyString_AS_STRING(self); p < e; p++)
if (*p == '\t') {
if (tabsize > 0) {
i = tabsize - (j % tabsize);
j += i;
while (i--) {
if (q >= qe)
goto overflow2;
*q++ = ' ';
for (p = PyString_AS_STRING(self); p < e; p++) {
if (*p == '\t') {
if (tabsize > 0) {
i = tabsize - (j % tabsize);
j += i;
while (i--) {
if (q >= qe)
goto overflow2;
*q++ = ' ';
}
}
}
}
else {
if (q >= qe)
goto overflow2;
*q++ = *p;
j++;
if (*p == '\n' || *p == '\r')
j = 0;
else {
if (q >= qe)
goto overflow2;
*q++ = *p;
j++;
if (*p == '\n' || *p == '\r')
j = 0;
}
}
return u;