[libxslt] Fix -Wshadow warnings in libexslt/dynamic.c



commit 4d9bfef22fccf654e60fd5ee64ae21e064998d96
Author: David Kilzer <ddkilzer apple com>
Date:   Tue Jan 7 15:08:33 2020 -0800

    Fix -Wshadow warnings in libexslt/dynamic.c
    
    * configure.ac: Enable -Wshadow for all builds.
    * libexslt/dynamic.c:
    (exsltDynMapFunction): Rename `cur` to `newChildNode` to fix
    shadow variable warnings.
    
    Closes #29.

 configure.ac       |  2 +-
 libexslt/dynamic.c | 30 +++++++++++++++---------------
 2 files changed, 16 insertions(+), 16 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index d676b122..d7142ff2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -474,7 +474,7 @@ if test "${GCC}" != "yes" ; then
                ;;
     esac
 else
-    CFLAGS="${CFLAGS} -Wall -Wextra -Wformat=2 -Wmissing-format-attribute"
+    CFLAGS="${CFLAGS} -Wall -Wextra -Wformat=2 -Wmissing-format-attribute -Wshadow"
     case "${host}" in
           alpha*-*-linux* )
               CFLAGS="${CFLAGS} -mieee"
diff --git a/libexslt/dynamic.c b/libexslt/dynamic.c
index a8cc72d9..4dd02c31 100644
--- a/libexslt/dynamic.c
+++ b/libexslt/dynamic.c
@@ -195,19 +195,19 @@ exsltDynMapFunction(xmlXPathParserContextPtr ctxt, int nargs)
                         break;
                     case XPATH_BOOLEAN:
                         if (container != NULL) {
-                            xmlNodePtr cur =
+                            xmlNodePtr newChildNode =
                                 xmlNewTextChild((xmlNodePtr) container, NULL,
                                                 BAD_CAST "boolean",
                                                 BAD_CAST (subResult->
                                                 boolval ? "true" : ""));
-                            if (cur != NULL) {
-                                cur->ns =
-                                    xmlNewNs(cur,
+                            if (newChildNode != NULL) {
+                                newChildNode->ns =
+                                    xmlNewNs(newChildNode,
                                              BAD_CAST
                                              "http://exslt.org/common";,
                                              BAD_CAST "exsl");
                                 xmlXPathNodeSetAddUnique(ret->nodesetval,
-                                                         cur);
+                                                         newChildNode);
                             }
                         }
                         break;
@@ -216,37 +216,37 @@ exsltDynMapFunction(xmlXPathParserContextPtr ctxt, int nargs)
                             xmlChar *val =
                                 xmlXPathCastNumberToString(subResult->
                                                            floatval);
-                            xmlNodePtr cur =
+                            xmlNodePtr newChildNode =
                                 xmlNewTextChild((xmlNodePtr) container, NULL,
                                                 BAD_CAST "number", val);
                             if (val != NULL)
                                 xmlFree(val);
 
-                            if (cur != NULL) {
-                                cur->ns =
-                                    xmlNewNs(cur,
+                            if (newChildNode != NULL) {
+                                newChildNode->ns =
+                                    xmlNewNs(newChildNode,
                                              BAD_CAST
                                              "http://exslt.org/common";,
                                              BAD_CAST "exsl");
                                 xmlXPathNodeSetAddUnique(ret->nodesetval,
-                                                         cur);
+                                                         newChildNode);
                             }
                         }
                         break;
                     case XPATH_STRING:
                         if (container != NULL) {
-                            xmlNodePtr cur =
+                            xmlNodePtr newChildNode =
                                 xmlNewTextChild((xmlNodePtr) container, NULL,
                                                 BAD_CAST "string",
                                                 subResult->stringval);
-                            if (cur != NULL) {
-                                cur->ns =
-                                    xmlNewNs(cur,
+                            if (newChildNode != NULL) {
+                                newChildNode->ns =
+                                    xmlNewNs(newChildNode,
                                              BAD_CAST
                                              "http://exslt.org/common";,
                                              BAD_CAST "exsl");
                                 xmlXPathNodeSetAddUnique(ret->nodesetval,
-                                                         cur);
+                                                         newChildNode);
                             }
                         }
                         break;


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