1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-04-01 10:50:08 +03:00

parser: Remove remaining calls to xml{Push|Pop}Input

This commit is contained in:
Nick Wellnhofer 2024-11-17 20:25:07 +01:00
parent 0f4f89005d
commit 497081baab
3 changed files with 14 additions and 14 deletions

View File

@ -4085,11 +4085,12 @@ htmlParseEndTag(htmlParserCtxtPtr ctxt)
static void
htmlParseContent(htmlParserCtxtPtr ctxt) {
GROW;
while ((PARSER_STOPPED(ctxt) == 0) &&
(ctxt->input->cur < ctxt->input->end)) {
int mode;
GROW;
mode = ctxt->endCheckState;
if ((mode == 0) && (CUR == '<')) {
@ -4265,7 +4266,7 @@ htmlCtxtParseContentInternal(htmlParserCtxtPtr ctxt, xmlParserInputPtr input) {
return(NULL);
}
if (xmlPushInput(ctxt, input) < 0) {
if (xmlCtxtPushInput(ctxt, input) < 0) {
xmlFreeNode(root);
return(NULL);
}
@ -4292,7 +4293,6 @@ htmlCtxtParseContentInternal(htmlParserCtxtPtr ctxt, xmlParserInputPtr input) {
nodePop(ctxt);
htmlnamePop(ctxt);
/* xmlPopInput would free the stream */
xmlCtxtPopInput(ctxt);
xmlFreeNode(root);

4
SAX2.c
View File

@ -325,7 +325,7 @@ xmlSAX2ExternalSubset(void *ctx, const xmlChar *name,
ctxt->inputNr = 0;
ctxt->inputMax = 5;
ctxt->input = NULL;
if (xmlPushInput(ctxt, input) < 0)
if (xmlCtxtPushInput(ctxt, input) < 0)
goto error;
if (input->filename == NULL)
@ -346,7 +346,7 @@ xmlSAX2ExternalSubset(void *ctx, const xmlChar *name,
*/
while (ctxt->inputNr > 1)
xmlPopInput(ctxt);
xmlFreeInputStream(xmlCtxtPopInput(ctxt));
consumed = ctxt->input->consumed;
buffered = ctxt->input->cur - ctxt->input->base;

View File

@ -2507,9 +2507,11 @@ xmlPopPE(xmlParserCtxtPtr ctxt) {
ent->flags |= XML_ENT_CHECKED;
}
xmlPopInput(ctxt);
xmlFreeInputStream(xmlCtxtPopInput(ctxt));
xmlParserEntityCheck(ctxt, ent->expandedSize);
GROW;
}
/**
@ -2589,9 +2591,6 @@ xmlSkipBlankCharsPE(xmlParserCtxtPtr ctxt) {
*
* DEPRECATED: Internal function, don't use.
*
* xmlPopInput: the current input pointed by ctxt->input came to an end
* pop it and return the next char.
*
* Returns the current xmlChar in the parser context
*/
xmlChar
@ -7936,13 +7935,15 @@ xmlParsePEReference(xmlParserCtxtPtr ctxt)
}
input = xmlNewEntityInputStream(ctxt, entity);
if (xmlPushInput(ctxt, input) < 0) {
if (xmlCtxtPushInput(ctxt, input) < 0) {
xmlFreeInputStream(input);
return;
}
entity->flags |= XML_ENT_EXPANDING;
GROW;
if (entity->etype == XML_EXTERNAL_PARAMETER_ENTITY) {
xmlDetectEncoding(ctxt);
@ -11777,7 +11778,7 @@ xmlCtxtParseDtd(xmlParserCtxtPtr ctxt, xmlParserInputPtr input,
const xmlChar *publicId, const xmlChar *systemId) {
xmlDtdPtr ret;
if (xmlPushInput(ctxt, input) < 0) {
if (xmlCtxtPushInput(ctxt, input) < 0) {
xmlFreeInputStream(input);
return(NULL);
}
@ -11981,7 +11982,7 @@ xmlCtxtParseContentInternal(xmlParserCtxtPtr ctxt, xmlParserInputPtr input,
}
}
if (xmlPushInput(ctxt, input) < 0)
if (xmlCtxtPushInput(ctxt, input) < 0)
goto error;
nameNsPush(ctxt, rootName, NULL, NULL, 0, 0);
@ -12048,7 +12049,6 @@ xmlCtxtParseContentInternal(xmlParserCtxtPtr ctxt, xmlParserInputPtr input,
namePop(ctxt);
spacePop(ctxt);
/* xmlPopInput would free the stream */
xmlCtxtPopInput(ctxt);
error:
@ -12111,7 +12111,7 @@ xmlCtxtParseEntity(xmlParserCtxtPtr ctxt, xmlEntityPtr ent) {
* - xmlCtxtParseEntity
*
* The nesting depth is limited by the maximum number of inputs,
* see xmlPushInput.
* see xmlCtxtPushInput.
*
* It's possible to make this non-recursive (minNsIndex must be
* stored in the input struct) at the expense of code readability.