Discard the internal Unicode buffer and destroy the writer instance.
+ If *writer* is ``NULL``, no operation is performed.
+
.. c:function:: int PyUnicodeWriter_WriteChar(PyUnicodeWriter *writer, Py_UCS4 ch)
Write the single Unicode character *ch* into *writer*.
return PyUnicodeWriter_Finish(writer);
error:
- if (writer != NULL) {
- PyUnicodeWriter_Discard(writer);
- }
+ PyUnicodeWriter_Discard(writer);
Py_ReprLeave((PyObject *)v);
return NULL;
}
void PyUnicodeWriter_Discard(PyUnicodeWriter *writer)
{
+ if (writer == NULL) {
+ return;
+ }
_PyUnicodeWriter_Dealloc((_PyUnicodeWriter*)writer);
PyMem_Free(writer);
}