]> granicus.if.org Git - libexpat/commitdiff
xmlparse.c: Resolve temp variable shadow (#268)
authorSebastian Pipping <sebastian@pipping.org>
Sat, 29 Jun 2019 20:40:04 +0000 (22:40 +0200)
committerSebastian Pipping <sebastian@pipping.org>
Sat, 29 Jun 2019 20:40:44 +0000 (22:40 +0200)
Also add const.

expat/lib/xmlparse.c

index 9c0987f4f6d8749d2d3a0885219e366c1ac67393..b3d1153b24e3b8f1a1a5579b23e93fea9028663b 100644 (file)
@@ -4979,18 +4979,19 @@ doProlog(XML_Parser parser,
     case XML_ROLE_GROUP_OPEN:
       if (parser->m_prologState.level >= parser->m_groupSize) {
         if (parser->m_groupSize) {
-          char *temp = (char *)REALLOC(parser, parser->m_groupConnector, parser->m_groupSize *= 2);
-          if (temp == NULL) {
+          char * const new_connector = (char *)REALLOC(parser,
+              parser->m_groupConnector, parser->m_groupSize *= 2);
+          if (new_connector == NULL) {
             parser->m_groupSize /= 2;
             return XML_ERROR_NO_MEMORY;
           }
-          parser->m_groupConnector = temp;
+          parser->m_groupConnector = new_connector;
           if (dtd->scaffIndex) {
-            int *temp = (int *)REALLOC(parser, dtd->scaffIndex,
-                          parser->m_groupSize * sizeof(int));
-            if (temp == NULL)
+            int * const new_scaff_index = (int *)REALLOC(parser,
+                dtd->scaffIndex, parser->m_groupSize * sizeof(int));
+            if (new_scaff_index == NULL)
               return XML_ERROR_NO_MEMORY;
-            dtd->scaffIndex = temp;
+            dtd->scaffIndex = new_scaff_index;
           }
         }
         else {