diff --git a/libs/libnamemanager/example/example_module_names.xml b/libs/libnamemanager/example/example_module_names.xml index 72534edc1..336eeb9c1 100644 --- a/libs/libnamemanager/example/example_module_names.xml +++ b/libs/libnamemanager/example/example_module_names.xml @@ -1,5 +1,5 @@ - + - + diff --git a/libs/libnamemanager/example/example_module_names_expect_errors.xml b/libs/libnamemanager/example/example_module_names_expect_errors.xml new file mode 100644 index 000000000..186ce92df --- /dev/null +++ b/libs/libnamemanager/example/example_module_names_expect_errors.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/libs/libnamemanager/src/base/module_name_map.cpp b/libs/libnamemanager/src/base/module_name_map.cpp index 7cceb6506..9fa435ee8 100644 --- a/libs/libnamemanager/src/base/module_name_map.cpp +++ b/libs/libnamemanager/src/base/module_name_map.cpp @@ -48,11 +48,11 @@ int ModuleNameMap::set_tag_to_name_pair(const std::string& tag, const std::strin VTR_LOG_ERROR("The customized name '%s' has already been mapped to a built-in name '%s'! Fail to bind it to a new built-in name '%s'\n", name.c_str(), result->second.c_str(), tag.c_str()); return CMD_EXEC_FATAL_ERROR; } + /* Clean up */ + name2tags_.erase(name); /* Create double link */ name2tags_[name] = tag; tag2names_[tag] = name; - /* Clean up */ - name2tags_.erase(name); return CMD_EXEC_SUCCESS; }