From: Thomas Markwalder Date: Wed, 27 Feb 2019 20:07:27 +0000 (-0500) Subject: [#404,!243] Addressed review comments X-Git-Tag: 478-improve-error-message-database-backend-mysql_base~11^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=efa1cb60e21e97a483a19b6bc8cbf6a1c377f10f;p=thirdparty%2Fkea.git [#404,!243] Addressed review comments Minor clean up and commentary. --- diff --git a/src/lib/dhcpsrv/cfg_option_def.cc b/src/lib/dhcpsrv/cfg_option_def.cc index 6530c9e2c3..2bb2f889a7 100644 --- a/src/lib/dhcpsrv/cfg_option_def.cc +++ b/src/lib/dhcpsrv/cfg_option_def.cc @@ -208,28 +208,26 @@ CfgOptionDef::toElement() const { void CfgOptionDef::merge(CfgOptionDef& other) { - + // The definitions in "other" are presumed to be valid and + // not in conflict with standard definitions. if (other.getContainer().getOptionSpaceNames().empty()) { // Nothing to merge, don't waste cycles. return; } - // Iterate over this config's definitions in each space. // If either a definition's name or code already exist in // that space in "other", skip it. Otherwise, add it to "other". - auto spaces = option_definitions_.getOptionSpaceNames(); - for (auto space = spaces.begin(); space != spaces.end(); ++space) { - OptionDefContainerPtr my_defs = getAll(*space); - for (auto my_def = my_defs->begin(); my_def != my_defs->end(); ++my_def) { - if ((other.get(*space, (*my_def)->getName())) || - (other.get(*space, (*my_def)->getCode()))) { + for (auto space : option_definitions_.getOptionSpaceNames()) { + for (auto my_def : *(getAll(space))) { + if ((other.get(space, my_def->getName())) || + (other.get(space, my_def->getCode()))) { // Already in "other" so skip it. continue; } // Not in "other" so add it. - other.add(*my_def, *space); + other.add(my_def, space); } }