diff options
author | Daniel Veillard <veillard@redhat.com> | 2012-08-06 11:16:30 +0800 |
---|---|---|
committer | Daniel Veillard <veillard@redhat.com> | 2012-08-06 11:16:30 +0800 |
commit | e258adecd0e19a6cfe6afa232b89aa416368820e (patch) | |
tree | 034a219a3ce5cc77645d0fd3ffdb4ed70741da8c /xmlIO.c | |
parent | 187e52901b01bb6ced0a7b57de393ec256973e39 (diff) | |
download | android_external_libxml2-e258adecd0e19a6cfe6afa232b89aa416368820e.tar.gz android_external_libxml2-e258adecd0e19a6cfe6afa232b89aa416368820e.tar.bz2 android_external_libxml2-e258adecd0e19a6cfe6afa232b89aa416368820e.zip |
Provide new accessors for xmlOutputBuffer
To avoid digging into buf->buffer insternal strcuture the two
new entry points xmlOutputBufferGetContent() and
xmlOutputBufferGetSize() should make the ode cleaner.
* include/libxml/xmlIO.h: add two new functions
* xmlIO.c: impement the 2 functions based on the new buffer entry points
Diffstat (limited to 'xmlIO.c')
-rw-r--r-- | xmlIO.c | 33 |
1 files changed, 33 insertions, 0 deletions
@@ -2922,6 +2922,39 @@ xmlOutputBufferCreateBuffer(xmlBufferPtr buffer, return(ret); } +/** + * xmlOutputBufferGetContent: + * @out: an xmlOutputBufferPtr + * + * Gives a pointer to the data currently held in the output buffer + * + * Returns a pointer to the data or NULL in case of error + */ +const xmlChar * +xmlOutputBufferGetContent(xmlOutputBufferPtr out) { + if ((out == NULL) || (out->buffer == NULL)) + return(NULL); + + return(xmlBufContent(out->buffer)); +} + +/** + * xmlOutputBufferGetSize: + * @out: an xmlOutputBufferPtr + * + * Gives the length of the data currently held in the output buffer + * + * Returns 0 in case or error or no data is held, the size otherwise + */ +size_t +xmlOutputBufferGetSize(xmlOutputBufferPtr out) { + if ((out == NULL) || (out->buffer == NULL)) + return(0); + + return(xmlBufUse(out->buffer)); +} + + #endif /* LIBXML_OUTPUT_ENABLED */ /** |