mirror of
https://github.com/python/cpython.git
synced 2025-11-08 21:52:45 +00:00
Merge removal of trailing whitespace from 3.3.
This commit is contained in:
commit
5263c13801
1 changed files with 7 additions and 7 deletions
|
|
@ -18,10 +18,10 @@ stringlib_expandtabs(PyObject *self, PyObject *args)
|
||||||
size_t i, j;
|
size_t i, j;
|
||||||
PyObject *u;
|
PyObject *u;
|
||||||
int tabsize = 8;
|
int tabsize = 8;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "|i:expandtabs", &tabsize))
|
if (!PyArg_ParseTuple(args, "|i:expandtabs", &tabsize))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* First pass: determine size of output string */
|
/* First pass: determine size of output string */
|
||||||
i = j = 0;
|
i = j = 0;
|
||||||
e = STRINGLIB_STR(self) + STRINGLIB_LEN(self);
|
e = STRINGLIB_STR(self) + STRINGLIB_LEN(self);
|
||||||
|
|
@ -48,20 +48,20 @@ stringlib_expandtabs(PyObject *self, PyObject *args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((i + j) > PY_SSIZE_T_MAX) {
|
if ((i + j) > PY_SSIZE_T_MAX) {
|
||||||
PyErr_SetString(PyExc_OverflowError, "result is too long");
|
PyErr_SetString(PyExc_OverflowError, "result is too long");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Second pass: create output string and fill it */
|
/* Second pass: create output string and fill it */
|
||||||
u = STRINGLIB_NEW(NULL, i + j);
|
u = STRINGLIB_NEW(NULL, i + j);
|
||||||
if (!u)
|
if (!u)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
j = 0;
|
j = 0;
|
||||||
q = STRINGLIB_STR(u);
|
q = STRINGLIB_STR(u);
|
||||||
|
|
||||||
for (p = STRINGLIB_STR(self); p < e; p++)
|
for (p = STRINGLIB_STR(self); p < e; p++)
|
||||||
if (*p == '\t') {
|
if (*p == '\t') {
|
||||||
if (tabsize > 0) {
|
if (tabsize > 0) {
|
||||||
|
|
@ -77,7 +77,7 @@ stringlib_expandtabs(PyObject *self, PyObject *args)
|
||||||
if (*p == '\n' || *p == '\r')
|
if (*p == '\n' || *p == '\r')
|
||||||
j = 0;
|
j = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return u;
|
return u;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue