diff options
author | Walter Dörwald <walter@livinglogic.de> | 2007-05-24 19:51:02 (GMT) |
---|---|---|
committer | Walter Dörwald <walter@livinglogic.de> | 2007-05-24 19:51:02 (GMT) |
commit | 5c2fab6e23f8254a4af2f2e34c41aae2c14fced0 (patch) | |
tree | c368e8ca0462a038cc61fdc659ed5befdf71d62b /Objects/unicodeobject.c | |
parent | 1d0476b2a231ffd70b342a77f0e83f28ac8a4f74 (diff) | |
download | cpython-5c2fab6e23f8254a4af2f2e34c41aae2c14fced0.zip cpython-5c2fab6e23f8254a4af2f2e34c41aae2c14fced0.tar.gz cpython-5c2fab6e23f8254a4af2f2e34c41aae2c14fced0.tar.bz2 |
Simplify %U handling by using Py_UNICODE_COPY.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r-- | Objects/unicodeobject.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 2fec095..999b166 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -690,11 +690,9 @@ PyUnicode_FromFormatV(const char *format, va_list vargs) case 'U': { PyObject *obj = va_arg(vargs, PyObject *); - Py_UNICODE *ucopy = PyUnicode_AS_UNICODE(obj); - Py_ssize_t usize = PyUnicode_GET_SIZE(obj); - Py_ssize_t upos; - for (upos = 0; upos<usize;) - *s++ = ucopy[upos++]; + Py_ssize_t size = PyUnicode_GET_SIZE(obj); + Py_UNICODE_COPY(s, PyUnicode_AS_UNICODE(obj), size); + s += size; break; } case 'S': |