1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-24 13:33:01 +03:00

writer: Implement xmlTextWriterClose

This function can be used to make sure that closing the output stream
succeeded.

Fixes #513.
This commit is contained in:
Nick Wellnhofer
2024-01-05 20:31:10 +01:00
parent f237e5b934
commit d2b55a7a02
4 changed files with 80 additions and 5 deletions

View File

@@ -4236,6 +4236,35 @@ xmlTextWriterFlush(xmlTextWriterPtr writer)
return count;
}
/**
* xmlTextWriterClose:
* @writer: the xmlTextWriterPtr
*
* Flushes and closes the output buffer.
*
* Available since 2.13.0.
*
* Returns an xmlParserErrors code.
*/
int
xmlTextWriterClose(xmlTextWriterPtr writer)
{
int result;
if ((writer == NULL) || (writer->out == NULL))
return XML_ERR_ARGUMENT;
result = xmlOutputBufferClose(writer->out);
writer->out = NULL;
if (result >= 0)
result = XML_ERR_OK;
else
result = -result;
return result;
}
/**
* misc
*/