mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-24 13:33:01 +03:00
Cleanup function xmlBufResetInput() to set input from Buffer
This was scattered in a number of modules, xmlParserInputPtr have usually their base, cur and end pointer set from an xmlBuf used as input. * buf.c buf.h: add a new function implementing this setup * parser.c HTMLparser.c catalog.c parserInternals.c xmlreader.c use the new function instead of digging into the buffer in all those modules
This commit is contained in:
18
buf.c
18
buf.c
@@ -1136,3 +1136,21 @@ xmlBufMergeBuffer(xmlBufPtr buf, xmlBufferPtr buffer) {
|
||||
xmlBufferFree(buffer);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlBufResetInput:
|
||||
* @buf: an xmlBufPtr
|
||||
* @input: an xmlParserInputPtr
|
||||
*
|
||||
* Update the input to use the current set of pointers from the buffer.
|
||||
*
|
||||
* Returns -1 in case of error, 0 otherwise, in any case @buffer is freed
|
||||
*/
|
||||
int
|
||||
xmlBufResetInput(xmlBufPtr buf, xmlParserInputPtr input) {
|
||||
if ((input == NULL) || (buf == NULL))
|
||||
return(-1);
|
||||
input->base = input->cur = buf->content;
|
||||
input->end = &buf->content[buf->use];
|
||||
return(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user