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:
13
parser.c
13
parser.c
@@ -11925,10 +11925,7 @@ xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax, void *user_data,
|
||||
}
|
||||
}
|
||||
inputStream->buf = buf;
|
||||
inputStream->cur =
|
||||
inputStream->base = xmlBufContent(inputStream->buf->buffer);
|
||||
inputStream->end = xmlBufEnd(inputStream->buf->buffer);
|
||||
|
||||
xmlBufResetInput(inputStream->buf->buffer, inputStream);
|
||||
inputPush(ctxt, inputStream);
|
||||
|
||||
/*
|
||||
@@ -13870,9 +13867,7 @@ xmlCreateMemoryParserCtxt(const char *buffer, int size) {
|
||||
|
||||
input->filename = NULL;
|
||||
input->buf = buf;
|
||||
input->cur =
|
||||
input->base = xmlBufContent(input->buf->buffer);
|
||||
input->end = xmlBufEnd(input->buf->buffer);
|
||||
xmlBufResetInput(input->buf->buffer, input);
|
||||
|
||||
inputPush(ctxt, input);
|
||||
return(ctxt);
|
||||
@@ -14442,9 +14437,7 @@ xmlCtxtResetPush(xmlParserCtxtPtr ctxt, const char *chunk,
|
||||
inputStream->filename = (char *)
|
||||
xmlCanonicPath((const xmlChar *) filename);
|
||||
inputStream->buf = buf;
|
||||
inputStream->cur =
|
||||
inputStream->base = xmlBufContent(buf->buffer);
|
||||
inputStream->end = xmlBufEnd(buf->buffer);
|
||||
xmlBufResetInput(buf->buffer, inputStream);
|
||||
|
||||
inputPush(ctxt, inputStream);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user