]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2311] fix variable shadowing
authorAndrei Pavel <andrei@isc.org>
Wed, 5 Oct 2022 14:06:34 +0000 (17:06 +0300)
committerAndrei Pavel <andrei@isc.org>
Fri, 21 Oct 2022 14:45:24 +0000 (17:45 +0300)
adaptor_config.cc:314:29: warning: declaration of ‘pools’ shadows a previous local [-Wshadow]
  314 |             ConstElementPtr pools = subnet->get("pd-pools");
      |                             ^~~~~
adaptor_config.cc:303:25: note: shadowed declaration is here
  303 |         ConstElementPtr pools = subnet->get("pools");
      |                         ^~~~~
translator_host.cc: In member function ‘isc::data::ElementPtr isc::yang::TranslatorHost::getHostKea(const std::string&)’:
translator_host.cc:89:25: warning: declaration of ‘hostname’ shadows a previous local [-Wshadow]
   89 |         ConstElementPtr hostname = getItem(xpath + "/server-hostname");
      |                         ^~~~~~~~
translator_host.cc:57:21: note: shadowed declaration is here
   57 |     ConstElementPtr hostname = getItem(xpath + "/hostname");
      |                     ^~~~~~~~
translator_host.cc: In member function ‘void isc::yang::TranslatorHost::setHostKea(const std::string&, isc::data::ConstElementPtr)’:
translator_host.cc:165:25: warning: declaration of ‘hostname’ shadows a previous local [-Wshadow]
  165 |         ConstElementPtr hostname = elem->get("server-hostname");
      |                         ^~~~~~~~
translator_host.cc:124:21: note: shadowed declaration is here
  124 |     ConstElementPtr hostname = elem->get("hostname");

src/lib/yang/adaptor_config.cc
src/lib/yang/translator_host.cc

index 696136a06e8f98a232739314b1eec52b41478c82..ca388306528f20baf4219ff934341efe7b25a04e 100644 (file)
@@ -311,10 +311,10 @@ AdaptorConfig::sanitizeOptionSubnets(ConstElementPtr subnets,
 
         // If this is v6, also sanitize pd-pools.
         if (space == DHCP6_SPACE) {
-            ConstElementPtr pools = subnet->get("pd-pools");
-            if (pools) {
-                if (!pools->empty()) {
-                    sanitizeOptionPools(pools, space, codes);
+            ConstElementPtr pd_pools = subnet->get("pd-pools");
+            if (pd_pools) {
+                if (!pd_pools->empty()) {
+                    sanitizeOptionPools(pd_pools, space, codes);
                 } else {
                     subnet->remove("pd-pools");
                 }
index fd4dc40668f5ce07f9a543d3ce77dc00878fc31c..f9e0d11a48450361b63df8b3ba5770bf530bc472 100644 (file)
@@ -85,9 +85,9 @@ TranslatorHost::getHostKea(const string& xpath) {
         if (next) {
             result->set("next-server", next);
         }
-        ConstElementPtr hostname = getItem(xpath + "/server-hostname");
-        if (hostname) {
-            result->set("server-hostname", hostname);
+        ConstElementPtr server_hostname = getItem(xpath + "/server-hostname");
+        if (server_hostname) {
+            result->set("server-hostname", server_hostname);
         }
         ConstElementPtr boot = getItem(xpath + "/boot-file-name");
         if (boot) {
@@ -161,9 +161,9 @@ TranslatorHost::setHostKea(const string& xpath, ConstElementPtr elem) {
         if (next) {
             setItem(xpath + "/next-server", next, SR_STRING_T);
         }
-        ConstElementPtr hostname = elem->get("server-hostname");
-        if (hostname) {
-            setItem(xpath + "/server-hostname", hostname, SR_STRING_T);
+        ConstElementPtr server_hostname = elem->get("server-hostname");
+        if (server_hostname) {
+            setItem(xpath + "/server-hostname", server_hostname, SR_STRING_T);
         }
         ConstElementPtr boot = elem->get("boot-file-name");
         if (boot) {