[Python-checkins] cpython: Move _PyUnicode_UTF8() and _PyUnicode_UTF8_LENGTH() outside unicodeobject.h

victor.stinner python-checkins at python.org
Thu Sep 29 19:46:11 CEST 2011


http://hg.python.org/cpython/rev/8cebe7310db7
changeset:   72528:8cebe7310db7
user:        Victor Stinner <victor.stinner at haypocalc.com>
date:        Thu Sep 29 19:31:34 2011 +0200
summary:
  Move _PyUnicode_UTF8() and _PyUnicode_UTF8_LENGTH() outside unicodeobject.h

Move these macros to unicodeobject.c

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


diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h
--- a/Include/unicodeobject.h
+++ b/Include/unicodeobject.h
@@ -377,16 +377,6 @@
      PyUnicode_IS_COMPACT(op) ? _PyUnicode_COMPACT_DATA(op) :   \
      _PyUnicode_NONCOMPACT_DATA(op))
 
-#define _PyUnicode_UTF8(op)                     \
-    (PyUnicode_IS_COMPACT_ASCII(op) ?           \
-     ((char*)((PyASCIIObject*)(op) + 1)) :      \
-     ((PyCompactUnicodeObject*)(op))->utf8)
-
-#define _PyUnicode_UTF8_LENGTH(op)                      \
-    (PyUnicode_IS_COMPACT_ASCII(op) ?                   \
-     ((PyASCIIObject*)(op))->length :                   \
-     ((PyCompactUnicodeObject*)(op))->utf8_length)
-
 /* Compute (index * char_size) where char_size is 2 ** (kind - 1).
 
    The index is a character index, the result is a size in bytes. */
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -105,6 +105,14 @@
         } \
     } while (0)
 
+#define _PyUnicode_UTF8(op)                     \
+    (PyUnicode_IS_COMPACT_ASCII(op) ?           \
+     ((char*)((PyASCIIObject*)(op) + 1)) :      \
+     ((PyCompactUnicodeObject*)(op))->utf8)
+#define _PyUnicode_UTF8_LENGTH(op)                      \
+    (PyUnicode_IS_COMPACT_ASCII(op) ?                   \
+     ((PyASCIIObject*)(op))->length :                   \
+     ((PyCompactUnicodeObject*)(op))->utf8_length)
 #define _PyUnicode_WSTR(op) (((PyASCIIObject*)(op))->wstr)
 #define _PyUnicode_WSTR_LENGTH(op) (((PyCompactUnicodeObject*)(op))->wstr_length)
 #define _PyUnicode_LENGTH(op) (((PyASCIIObject *)(op))->length)

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


More information about the Python-checkins mailing list