summaryrefslogtreecommitdiffstats
path: root/src/lib/dhcpsrv/cfg_mac_source.cc
diff options
context:
space:
mode:
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);
}
-};
-};
+}
+}