]> granicus.if.org Git - python/commitdiff
Micro-optimize unicode_expandtabs(): use FILL() macro to write N spaces
authorVictor Stinner <vstinner@wyplay.com>
Wed, 22 Feb 2012 12:37:04 +0000 (13:37 +0100)
committerVictor Stinner <vstinner@wyplay.com>
Wed, 22 Feb 2012 12:37:04 +0000 (13:37 +0100)
Objects/unicodeobject.c

index afe7a9fa68d2c4298987407ca450c9f865f52a4d..c8714209141d8ff48c1a65c0a5bf641f6f31d233 100644 (file)
@@ -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 {