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
diff --git a/HTMLparser.c b/HTMLparser.c
index 4d36617..fdbef80 100644
--- a/HTMLparser.c
+++ b/HTMLparser.c
@@ -3519,9 +3519,7 @@
"htmlCheckEncoding: encoder error\n",
NULL, NULL);
}
- ctxt->input->base =
- ctxt->input->cur = xmlBufContent(ctxt->input->buf->buffer);
- ctxt->input->end = xmlBufEnd(ctxt->input->buf->buffer);
+ xmlBufResetInput(ctxt->input->buf->buffer, ctxt->input);
}
}
}
@@ -4906,9 +4904,7 @@
input->filename = NULL;
input->buf = buf;
- input->cur =
- input->base = xmlBufContent(input->buf->buffer);
- input->end = xmlBufEnd(input->buf->buffer);
+ xmlBufResetInput(buf->buffer, input);
inputPush(ctxt, input);
return(ctxt);
@@ -6106,9 +6102,7 @@
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);