]> granicus.if.org Git - libexpat/commitdiff
Comment why tidy-up parse cannot be suspended
authorRhodri James <rhodri@kynesim.co.uk>
Mon, 15 May 2017 17:18:29 +0000 (18:18 +0100)
committerSebastian Pipping <sebastian@pipping.org>
Sat, 22 Jul 2017 20:49:16 +0000 (22:49 +0200)
Also add tags so that lcov can ignore the unreachable code.

expat/lib/xmlparse.c

index d26ebd3cb18d0e876909fd30d4605a9dfdd3a64d..111474e56c6d0bf32b0eba5a3c9941d2f88d07d9 100644 (file)
@@ -1870,9 +1870,22 @@ XML_Parse(XML_Parser parser, const char *s, int len, int isFinal)
     if (errorCode == XML_ERROR_NONE) {
       switch (ps_parsing) {
       case XML_SUSPENDED:
+        /* It is hard to be certain, but it seems that this case
+         * cannot occur.  This code is cleaning up a previous parse
+         * with no new data (since len == 0).  Changing the parsing
+         * state requires getting to execute a handler function, and
+         * there doesn't seem to be an opportunity for that while in
+         * this circumstance.
+         *
+         * Given the uncertainty, we retain the code but exclude it
+         * from coverage tests.
+         *
+         * LCOV_EXCL_START
+         */
         XmlUpdatePosition(encoding, positionPtr, bufferPtr, &position);
         positionPtr = bufferPtr;
         return XML_STATUS_SUSPENDED;
+        /* LCOV_EXCL_END */
       case XML_INITIALIZED:
       case XML_PARSING:
         ps_parsing = XML_FINISHED;