diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2013-04-11 20:09:04 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2013-04-11 20:09:04 (GMT) |
commit | a0dd0213cc457bdf2b04206548f5a269db256d4d (patch) | |
tree | d282d6b615e9feef64d68fa48cac54e22fd97150 /Objects | |
parent | d8a5cc91e6559e11ca28e6a915017433b14b12d1 (diff) | |
download | cpython-a0dd0213cc457bdf2b04206548f5a269db256d4d.zip cpython-a0dd0213cc457bdf2b04206548f5a269db256d4d.tar.gz cpython-a0dd0213cc457bdf2b04206548f5a269db256d4d.tar.bz2 |
Close #17693: Rewrite CJK decoders to use the _PyUnicodeWriter API instead of
the legacy Py_UNICODE API.
Add also a new _PyUnicodeWriter_WriteChar() function.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/unicodeobject.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 162221c..e52571d 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -12948,6 +12948,16 @@ _PyUnicodeWriter_PrepareInternal(_PyUnicodeWriter *writer, } int +_PyUnicodeWriter_WriteChar(_PyUnicodeWriter *writer, Py_UCS4 ch) +{ + if (_PyUnicodeWriter_Prepare(writer, 1, ch) < 0) + return -1; + PyUnicode_WRITE(writer->kind, writer->data, writer->pos, ch); + writer->pos++; + return 0; +} + +int _PyUnicodeWriter_WriteStr(_PyUnicodeWriter *writer, PyObject *str) { Py_UCS4 maxchar; |