summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-04-11 20:09:04 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-04-11 20:09:04 (GMT)
commita0dd0213cc457bdf2b04206548f5a269db256d4d (patch)
treed282d6b615e9feef64d68fa48cac54e22fd97150 /Objects
parentd8a5cc91e6559e11ca28e6a915017433b14b12d1 (diff)
downloadcpython-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.c10
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;