diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2013-04-09 20:38:52 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2013-04-09 20:38:52 (GMT) |
commit | f50a4e9bc940e701feb142c35a267c90fc1fff8e (patch) | |
tree | cc231b632bb7db5de3df644f1360df04a4f71b07 /Objects | |
parent | 9c79e41fc5f5cb76b89af040b1675896d57051d9 (diff) | |
download | cpython-f50a4e9bc940e701feb142c35a267c90fc1fff8e.zip cpython-f50a4e9bc940e701feb142c35a267c90fc1fff8e.tar.gz cpython-f50a4e9bc940e701feb142c35a267c90fc1fff8e.tar.bz2 |
Don't calls macros in PyUnicode_WRITE() parameters
PyUnicode_WRITE() expands some parameters twice or more.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/unicodeobject.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 52fe3bc..838d9de 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -1958,13 +1958,17 @@ _PyUnicode_FromUCS2(const Py_UCS2 *u, Py_ssize_t size) assert(size > 0); if (size == 1) { Py_UCS4 ch = u[0]; + int kind; + void *data; if (ch < 256) return get_latin1_char((unsigned char)ch); res = PyUnicode_New(1, ch); if (res == NULL) return NULL; - PyUnicode_WRITE(PyUnicode_KIND(res), PyUnicode_DATA(res), 0, ch); + kind = PyUnicode_KIND(res); + data = PyUnicode_DATA(res); + PyUnicode_WRITE(kind, data, 0, ch); assert(_PyUnicode_CheckConsistency(res, 1)); return res; } @@ -1994,13 +1998,17 @@ _PyUnicode_FromUCS4(const Py_UCS4 *u, Py_ssize_t size) assert(size > 0); if (size == 1) { Py_UCS4 ch = u[0]; + int kind; + void *data; if (ch < 256) return get_latin1_char((unsigned char)ch); res = PyUnicode_New(1, ch); if (res == NULL) return NULL; - PyUnicode_WRITE(PyUnicode_KIND(res), PyUnicode_DATA(res), 0, ch); + kind = PyUnicode_KIND(res); + data = PyUnicode_DATA(res); + PyUnicode_WRITE(kind, data, 0, ch); assert(_PyUnicode_CheckConsistency(res, 1)); return res; } |