1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-29 11:41:22 +03:00

Remove unneeded progress checks in HTML parser

The HTML parser should now be guaranteed to make progress, so the
checks became unnecessary.
This commit is contained in:
Nick Wellnhofer
2020-08-09 14:29:35 +02:00
parent 9de7b94d4f
commit f6a9541fb8

View File

@ -3852,8 +3852,6 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) {
while ((CUR != 0) &&
(CUR != '>') &&
((CUR != '/') || (NXT(1) != '>'))) {
long cons = ctxt->nbChars;
GROW;
attname = htmlParseAttribute(ctxt, &attvalue);
if (attname != NULL) {
@ -3920,12 +3918,6 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) {
failed:
SKIP_BLANKS;
if (cons == ctxt->nbChars) {
htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR,
"htmlParseStartTag: problem parsing attributes\n",
NULL, NULL);
break;
}
}
/*
@ -4161,8 +4153,6 @@ htmlParseContent(htmlParserCtxtPtr ctxt) {
currentNode = xmlStrdup(ctxt->name);
depth = ctxt->nameNr;
while (1) {
long cons = ctxt->nbChars;
GROW;
if (ctxt->instate == XML_PARSER_EOF)
@ -4282,15 +4272,6 @@ htmlParseContent(htmlParserCtxtPtr ctxt) {
else {
htmlParseCharData(ctxt);
}
if (cons == ctxt->nbChars) {
if (ctxt->node != NULL) {
htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR,
"detected an error in element content\n",
NULL, NULL);
}
break;
}
}
GROW;
}
@ -4561,8 +4542,6 @@ htmlParseContentInternal(htmlParserCtxtPtr ctxt) {
currentNode = xmlStrdup(ctxt->name);
depth = ctxt->nameNr;
while (1) {
long cons = ctxt->nbChars;
GROW;
if (ctxt->instate == XML_PARSER_EOF)
@ -4696,15 +4675,6 @@ htmlParseContentInternal(htmlParserCtxtPtr ctxt) {
else {
htmlParseCharData(ctxt);
}
if (cons == ctxt->nbChars) {
if (ctxt->node != NULL) {
htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR,
"detected an error in element content\n",
NULL, NULL);
}
break;
}
}
GROW;
}
@ -5702,7 +5672,6 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
}
case XML_PARSER_CONTENT: {
xmlChar chr[2] = { 0, 0 };
long cons;
/*
* Handle preparsed entities and charRef
@ -5747,7 +5716,6 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
goto done;
cur = in->cur[0];
next = in->cur[1];
cons = ctxt->nbChars;
if ((xmlStrEqual(ctxt->name, BAD_CAST"script")) ||
(xmlStrEqual(ctxt->name, BAD_CAST"style"))) {
/*
@ -5877,15 +5845,6 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
}
}
}
if (cons == ctxt->nbChars) {
if (ctxt->node != NULL) {
htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR,
"detected an error in element content\n",
NULL, NULL);
}
NEXT;
break;
}
break;
}