Commit 2df5585f authored by Thomas Markwalder's avatar Thomas Markwalder
Browse files

[2355] Cleaned up some minor issues spotted in review.

parent 36f7b7fa
......@@ -155,7 +155,6 @@ public:
/// @brief Constructor
///
/// @param ignored first parameter
/// @param global_context is a pointer to the global context which
/// stores global scope parameters, options, option defintions.
Subnet4ConfigParser(const std::string&)
:SubnetConfigParser("", globalContext()) {
......@@ -512,7 +511,7 @@ configureDhcp4Server(Dhcpv4Srv&, isc::data::ConstElementPtr config_set) {
return (answer);
}
ParserContextPtr globalContext() {
ParserContextPtr& globalContext() {
static ParserContextPtr global_context_ptr(new ParserContext(Option::V4));
return (global_context_ptr);
}
......
......@@ -63,8 +63,8 @@ configureDhcp4Server(Dhcpv4Srv&,
/// @brief Returns the global context
///
/// @return a const reference to the global context
ParserContextPtr globalContext();
/// @return a reference to the global context
ParserContextPtr& globalContext();
}; // end of isc::dhcp namespace
}; // end of isc namespace
......
......@@ -53,11 +53,7 @@ public:
// Checks if global parameter of name have expected_value
void checkGlobalUint32(string name, uint32_t expected_value) {
const Uint32StoragePtr uint32_defaults =
#if 0
getGlobalParserContext().uint32_values_;
#else
globalContext()->uint32_values_;
#endif
try {
uint32_t actual_value = uint32_defaults->getParam(name);
EXPECT_EQ(expected_value, actual_value);
......
......@@ -177,7 +177,6 @@ public:
/// @brief Constructor
///
/// @param ignored first parameter
/// @param global_context is a pointer to the global context which
/// stores global scope parameters, options, option defintions.
Subnet6ConfigParser(const std::string&)
:SubnetConfigParser("", globalContext()) {
......@@ -319,7 +318,7 @@ public:
/// @param subnets_list pointer to a list of IPv6 subnets
void build(ConstElementPtr subnets_list) {
BOOST_FOREACH(ConstElementPtr subnet, subnets_list->listValue()) {
ParserPtr parser(new Subnet6ConfigParser("subnet" ));
ParserPtr parser(new Subnet6ConfigParser("subnet"));
parser->build(subnet);
subnets_.push_back(parser);
}
......@@ -541,7 +540,7 @@ configureDhcp6Server(Dhcpv6Srv&, isc::data::ConstElementPtr config_set) {
return (answer);
}
ParserContextPtr globalContext() {
ParserContextPtr& globalContext() {
static ParserContextPtr global_context_ptr(new ParserContext(Option::V6));
return (global_context_ptr);
}
......
......@@ -51,8 +51,8 @@ configureDhcp6Server(Dhcpv6Srv& server, isc::data::ConstElementPtr config_set);
/// @brief Returns the global context
///
/// @returns a const reference to the global context
ParserContextPtr globalContext();
/// @returns a reference to the global context
ParserContextPtr& globalContext();
}; // end of isc::dhcp namespace
}; // end of isc namespace
......
......@@ -55,17 +55,18 @@ ParserContext::ParserContext(const ParserContext& rhs):
ParserContext&
ParserContext::operator=(const ParserContext& rhs) {
ParserContext tmp(rhs);
boolean_values_ =
BooleanStoragePtr(new BooleanStorage(*(rhs.boolean_values_)));
uint32_values_ =
Uint32StoragePtr(new Uint32Storage(*(tmp.uint32_values_)));
string_values_ =
StringStoragePtr(new StringStorage(*(tmp.string_values_)));
options_ = OptionStoragePtr(new OptionStorage(*(tmp.options_)));
option_defs_ =
OptionDefStoragePtr(new OptionDefStorage(*(tmp.option_defs_)));
universe_ = rhs.universe_;
if (this != &rhs) {
boolean_values_ =
BooleanStoragePtr(new BooleanStorage(*(rhs.boolean_values_)));
uint32_values_ =
Uint32StoragePtr(new Uint32Storage(*(rhs.uint32_values_)));
string_values_ =
StringStoragePtr(new StringStorage(*(rhs.string_values_)));
options_ = OptionStoragePtr(new OptionStorage(*(rhs.options_)));
option_defs_ =
OptionDefStoragePtr(new OptionDefStorage(*(rhs.option_defs_)));
universe_ = rhs.universe_;
}
return (*this);
}
......
......@@ -163,7 +163,7 @@ public:
// make sure we start with a clean configuration
CfgMgr::instance().deleteSubnets4();
CfgMgr::instance().deleteSubnets6();
//CfgMgr::instance().deleteOptionDefs();
CfgMgr::instance().deleteOptionDefs();
}
~CfgMgrTest() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment