Close #17693: Rewrite CJK decoders to use the _PyUnicodeWriter API instead of

the legacy Py_UNICODE API.

Add also a new _PyUnicodeWriter_WriteChar() function.
This commit is contained in:
Victor Stinner 2013-04-11 22:09:04 +02:00
parent d8a5cc91e6
commit a0dd0213cc
15 changed files with 401 additions and 440 deletions

View file

@ -12947,6 +12947,16 @@ _PyUnicodeWriter_PrepareInternal(_PyUnicodeWriter *writer,
return 0;
}
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)
{