mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
Micro-optimize unicode_expandtabs(): use FILL() macro to write N spaces
This commit is contained in:
parent
15e9ed299c
commit
da79e632c4
1 changed files with 2 additions and 5 deletions
|
@ -9975,7 +9975,6 @@ pad(PyObject *self,
|
||||||
assert(_PyUnicode_CheckConsistency(u, 1));
|
assert(_PyUnicode_CheckConsistency(u, 1));
|
||||||
return u;
|
return u;
|
||||||
}
|
}
|
||||||
#undef FILL
|
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
PyUnicode_Splitlines(PyObject *string, int keepends)
|
PyUnicode_Splitlines(PyObject *string, int keepends)
|
||||||
|
@ -11141,10 +11140,8 @@ unicode_expandtabs(PyObject *self, PyObject *args)
|
||||||
if (tabsize > 0) {
|
if (tabsize > 0) {
|
||||||
incr = tabsize - (line_pos % tabsize);
|
incr = tabsize - (line_pos % tabsize);
|
||||||
line_pos += incr;
|
line_pos += incr;
|
||||||
while (incr--) {
|
FILL(kind, dest_data, ' ', j, incr);
|
||||||
PyUnicode_WRITE(kind, dest_data, j, ' ');
|
j += incr;
|
||||||
j++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue