diff options
author | Victor Stinner <vstinner@wyplay.com> | 2012-02-22 12:37:04 (GMT) |
---|---|---|
committer | Victor Stinner <vstinner@wyplay.com> | 2012-02-22 12:37:04 (GMT) |
commit | da79e632c45ad1a403317c08d9fb309130cb3e7e (patch) | |
tree | ab1e734d35c940ddfc8f212a611a208816030c3a | |
parent | 15e9ed299c5cd8adca21ac5e8e9691eacc731700 (diff) | |
download | cpython-da79e632c45ad1a403317c08d9fb309130cb3e7e.zip cpython-da79e632c45ad1a403317c08d9fb309130cb3e7e.tar.gz cpython-da79e632c45ad1a403317c08d9fb309130cb3e7e.tar.bz2 |
Micro-optimize unicode_expandtabs(): use FILL() macro to write N spaces
-rw-r--r-- | Objects/unicodeobject.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index afe7a9f..c871420 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -9975,7 +9975,6 @@ pad(PyObject *self, assert(_PyUnicode_CheckConsistency(u, 1)); return u; } -#undef FILL PyObject * PyUnicode_Splitlines(PyObject *string, int keepends) @@ -11141,10 +11140,8 @@ unicode_expandtabs(PyObject *self, PyObject *args) if (tabsize > 0) { incr = tabsize - (line_pos % tabsize); line_pos += incr; - while (incr--) { - PyUnicode_WRITE(kind, dest_data, j, ' '); - j++; - } + FILL(kind, dest_data, ' ', j, incr); + j += incr; } } else { |