mirror of
https://github.com/python/cpython.git
synced 2025-08-28 20:56:54 +00:00
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:
parent
d8a5cc91e6
commit
a0dd0213cc
15 changed files with 401 additions and 440 deletions
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue