diff --git a/src/core/model/object-base.cc b/src/core/model/object-base.cc index 9ce2e3a3b..9e06b7c19 100644 --- a/src/core/model/object-base.cc +++ b/src/core/model/object-base.cc @@ -124,46 +124,46 @@ ObjectBase::ConstructSelf (const AttributeConstructionList &attributes) } } - { - // No matching attribute value so we try to look at the env var. + { + // No matching attribute value so we try to look at the env var. #ifdef HAVE_GETENV - char *envVar = getenv ("NS_ATTRIBUTE_DEFAULT"); - if (envVar != 0) - { - std::string env = std::string (envVar); - std::string::size_type cur = 0; - std::string::size_type next = 0; - while (next != std::string::npos) - { - next = env.find (";", cur); - std::string tmp = std::string (env, cur, next-cur); - std::string::size_type equal = tmp.find ("="); - if (equal != std::string::npos) - { - std::string name = tmp.substr (0, equal); - std::string value = tmp.substr (equal+1, tmp.size () - equal - 1); - if (name == tid.GetAttributeFullName (i)) - { - if (DoSet (info.accessor, info.checker, StringValue (value))) - { - NS_LOG_DEBUG ("construct \""<< tid.GetName ()<<"::"<< - info.name <<"\" from env var"); - break; - } - } - } - cur = next + 1; - } - } + char *envVar = getenv ("NS_ATTRIBUTE_DEFAULT"); + if (envVar != 0) + { + std::string env = std::string (envVar); + std::string::size_type cur = 0; + std::string::size_type next = 0; + while (next != std::string::npos) + { + next = env.find (";", cur); + std::string tmp = std::string (env, cur, next-cur); + std::string::size_type equal = tmp.find ("="); + if (equal != std::string::npos) + { + std::string name = tmp.substr (0, equal); + std::string value = tmp.substr (equal+1, tmp.size () - equal - 1); + if (name == tid.GetAttributeFullName (i)) + { + if (DoSet (info.accessor, info.checker, StringValue (value))) + { + NS_LOG_DEBUG ("construct \""<< tid.GetName ()<<"::"<< + info.name <<"\" from env var"); + break; + } + } + } + cur = next + 1; + } + } #endif /* HAVE_GETENV */ - } + } - { - // No matching attribute value so we try to set the default value. - DoSet (info.accessor, info.checker, *info.initialValue); - NS_LOG_DEBUG ("construct \""<< tid.GetName ()<<"::"<< - info.name <<"\" from initial value."); - } + { + // No matching attribute value so we try to set the default value. + DoSet (info.accessor, info.checker, *info.initialValue); + NS_LOG_DEBUG ("construct \""<< tid.GetName ()<<"::"<< + info.name <<"\" from initial value."); + } } tid = tid.GetParent (); } while (tid != ObjectBase::GetTypeId ());