summaryrefslogtreecommitdiffstats
path: root/src/lib/dhcpsrv/cfg_mac_source.cc
diff options
context:
space:
mode:
authorRazvan Becheriu <razvan@isc.org>2024-01-12 15:31:50 +0100
committerRazvan Becheriu <razvan@isc.org>2024-01-22 16:49:59 +0100
commit1b4d7b0293bca6657d1f798e6e4e65ce95d2dca4 (patch)
treefc89d85f5dd097dd85a2921ce1382980e012a423 /src/lib/dhcpsrv/cfg_mac_source.cc
parent[#3119] replace const auto with auto const (diff)
downloadkea-1b4d7b0293bca6657d1f798e6e4e65ce95d2dca4.tar.xz
kea-1b4d7b0293bca6657d1f798e6e4e65ce95d2dca4.zip
[#3119] use range based for loop or BOOST_FOREACH
Diffstat (limited to 'src/lib/dhcpsrv/cfg_mac_source.cc')
-rw-r--r--src/lib/dhcpsrv/cfg_mac_source.cc16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/lib/dhcpsrv/cfg_mac_source.cc b/src/lib/dhcpsrv/cfg_mac_source.cc
index 7a0db260b3..8fbc9c71d3 100644
--- a/src/lib/dhcpsrv/cfg_mac_source.cc
+++ b/src/lib/dhcpsrv/cfg_mac_source.cc
@@ -55,9 +55,8 @@ uint32_t CfgMACSource::MACSourceFromText(const std::string& name) {
}
void CfgMACSource::add(uint32_t source) {
- for (CfgMACSources::const_iterator it = mac_sources_.begin();
- it != mac_sources_.end(); ++it) {
- if (*it == source) {
+ for (auto const& it : mac_sources_) {
+ if (it == source) {
isc_throw(InvalidParameter, "mac-source parameter " << source
<< "' specified twice.");
}
@@ -67,17 +66,16 @@ void CfgMACSource::add(uint32_t source) {
ElementPtr CfgMACSource::toElement() const {
ElementPtr result = Element::createList();
- for (CfgMACSources::const_iterator source = mac_sources_.cbegin();
- source != mac_sources_.cend(); ++source) {
+ for (auto const& source : mac_sources_) {
std::string name;
for (unsigned i = 0; i < sizeof(sources)/sizeof(sources[0]); ++i) {
- if (sources[i].type == *source) {
+ if (sources[i].type == source) {
name = sources[i].name;
break;
}
}
if (name.empty()) {
- isc_throw(ToElementError, "invalid MAC source: " << *source);
+ isc_throw(ToElementError, "invalid MAC source: " << source);
}
result->add(Element::create(name));
}
@@ -85,5 +83,5 @@ ElementPtr CfgMACSource::toElement() const {
return (result);
}
-};
-};
+}
+}