[libxml2] Remove unneeded progress checks in HTML parser



commit f6a9541fb85c1ffdee1399ad2c0a54faaebf9f38
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Sun Aug 9 14:29:35 2020 +0200

    Remove unneeded progress checks in HTML parser
    
    The HTML parser should now be guaranteed to make progress, so the
    checks became unnecessary.

 HTMLparser.c | 41 -----------------------------------------
 1 file changed, 41 deletions(-)
---
diff --git a/HTMLparser.c b/HTMLparser.c
index b98129854..541dcb5c7 100644
--- a/HTMLparser.c
+++ b/HTMLparser.c
@@ -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;
            }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]