[Python-checkins] cpython: Strip trailing spaces in unicodeobject.[ch]

victor.stinner python-checkins at python.org
Wed Sep 28 22:08:37 CEST 2011


http://hg.python.org/cpython/rev/93cc591cffe4
changeset:   72494:93cc591cffe4
user:        Victor Stinner <victor.stinner at haypocalc.com>
date:        Wed Sep 28 21:41:31 2011 +0200
summary:
  Strip trailing spaces in unicodeobject.[ch]

files:
  Include/unicodeobject.h |  10 +++++-----
  Objects/unicodeobject.c |  20 ++++++++++----------
  2 files changed, 15 insertions(+), 15 deletions(-)


diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h
--- a/Include/unicodeobject.h
+++ b/Include/unicodeobject.h
@@ -356,13 +356,13 @@
 #define PyUnicode_IS_COMPACT(op) \
     (((PyASCIIObject*)(op))->state.compact)
 
-/* Return one of the PyUnicode_*_KIND values defined above. */ 
+/* Return one of the PyUnicode_*_KIND values defined above. */
 #define PyUnicode_KIND(op) \
     (assert(PyUnicode_Check(op)), \
      assert(PyUnicode_IS_READY(op)),            \
      ((PyASCIIObject *)(op))->state.kind)
 
-/* Return a void pointer to the raw unicode buffer. */ 
+/* Return a void pointer to the raw unicode buffer. */
 #define _PyUnicode_COMPACT_DATA(op)                     \
     (PyUnicode_IS_COMPACT_ASCII(op) ?                   \
      ((void*)((PyASCIIObject*)(op) + 1)) :              \
@@ -509,7 +509,7 @@
 
 /* Initializes the canonical string representation from a the deprected
    wstr/Py_UNICODE representation.  This function is used to convert
-   unicode objects which were created using the old API to the new flexible 
+   unicode objects which were created using the old API to the new flexible
    format introduced with PEP 393.  The PyUnicode_READY() macro can be
    more efficient if the string is already ready. */
 #ifndef Py_LIMITED_API
@@ -641,7 +641,7 @@
     PyObject *unicode
 );
 
-/* Get the number of Py_UNICODE units in the 
+/* Get the number of Py_UNICODE units in the
    string representation. */
 
 PyAPI_FUNC(Py_ssize_t) PyUnicode_GetSize(
@@ -857,7 +857,7 @@
 
    In case of an error, no *size is set.
 
-   This funcation caches the UTF-8 encoded string in the unicodeobject 
+   This funcation caches the UTF-8 encoded string in the unicodeobject
    and subsequent calls will return the same string.  The memory is relased
    when the unicodeobject is deallocated.
 
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -643,7 +643,7 @@
                   PyUnicode_KIND_SIZE(to_kind, how_many));
         return how_many;
     }
-    
+
     if (from_kind > to_kind) {
         /* slow path to check for character overflow */
         const Py_UCS4 to_maxchar = PyUnicode_MAX_CHAR_VALUE(to);
@@ -678,7 +678,7 @@
             );
         return how_many;
     }
-    else if (from_kind == PyUnicode_1BYTE_KIND 
+    else if (from_kind == PyUnicode_1BYTE_KIND
              && to_kind == PyUnicode_4BYTE_KIND)
     {
         _PyUnicode_CONVERT_BYTES(
@@ -703,7 +703,7 @@
     PyErr_Format(PyExc_ValueError,
                  "Cannot copy UCS%u characters "
                  "into a string of UCS%u characters",
-                 1 << (from_kind - 1), 
+                 1 << (from_kind - 1),
                  1 << (to_kind -1));
     return -1;
 }
@@ -8155,8 +8155,8 @@
             /* If the maxchar increased so that the kind changed, not all
                characters are representable anymore and we need to fix the
                string again. This only happens in very few cases. */
-            if (PyUnicode_CopyCharacters(v, 0, 
-                                         (PyObject*)self, 0, 
+            if (PyUnicode_CopyCharacters(v, 0,
+                                         (PyObject*)self, 0,
                                          PyUnicode_GET_LENGTH(self)) < 0)
             {
                 Py_DECREF(u);
@@ -8166,8 +8166,8 @@
             assert(maxchar_old > 0 && maxchar_old <= maxchar_new);
         }
         else {
-            if (PyUnicode_CopyCharacters(v, 0, 
-                                         u, 0, 
+            if (PyUnicode_CopyCharacters(v, 0,
+                                         u, 0,
                                          PyUnicode_GET_LENGTH(self)) < 0)
             {
                 Py_DECREF(u);
@@ -8558,8 +8558,8 @@
         FILL(kind, data, fill, 0, left);
     if (right)
         FILL(kind, data, fill, left + _PyUnicode_LENGTH(self), right);
-    if (PyUnicode_CopyCharacters(u, left, 
-                                 (PyObject*)self, 0, 
+    if (PyUnicode_CopyCharacters(u, left,
+                                 (PyObject*)self, 0,
                                  _PyUnicode_LENGTH(self)) < 0)
     {
         Py_DECREF(u);
@@ -9479,7 +9479,7 @@
         goto onError;
     if (PyUnicode_CopyCharacters(w, 0, u, 0, PyUnicode_GET_LENGTH(u)) < 0)
         goto onError;
-    if (PyUnicode_CopyCharacters(w, PyUnicode_GET_LENGTH(u), 
+    if (PyUnicode_CopyCharacters(w, PyUnicode_GET_LENGTH(u),
                                  v, 0,
                                  PyUnicode_GET_LENGTH(v)) < 0)
         goto onError;

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list