From: Andrei Pavel Date: Wed, 5 Oct 2022 14:06:34 +0000 (+0300) Subject: [#2311] fix variable shadowing X-Git-Tag: Kea-2.3.2~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6e2f5e012fac5980eb0907b4a9cfc36822efb06a;p=thirdparty%2Fkea.git [#2311] fix variable shadowing 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"); --- diff --git a/src/lib/yang/adaptor_config.cc b/src/lib/yang/adaptor_config.cc index 696136a06e..ca38830652 100644 --- a/src/lib/yang/adaptor_config.cc +++ b/src/lib/yang/adaptor_config.cc @@ -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"); } diff --git a/src/lib/yang/translator_host.cc b/src/lib/yang/translator_host.cc index fd4dc40668..f9e0d11a48 100644 --- a/src/lib/yang/translator_host.cc +++ b/src/lib/yang/translator_host.cc @@ -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) {