no point in using envGetConfigParamPtr except for predefine parameters

Unless a default is provided, this is equivlent to getenv()
This commit is contained in:
Michael Davidsaver
2015-09-04 13:50:13 -04:00
parent 0fe4e41099
commit 1d30949690
2 changed files with 2 additions and 8 deletions

View File

@@ -242,8 +242,6 @@ void Properties::list()
SystemConfigurationImpl::SystemConfigurationImpl() :
_properties(new Properties())
{
_envParam.name = new char[256];
_envParam.pdflt = NULL;
// no exception, default value is taken
//_ibuffer.exceptions ( ifstream::failbit | ifstream::badbit );
//_obuffer.exceptions ( ifstream::failbit | ifstream::badbit );
@@ -251,7 +249,6 @@ SystemConfigurationImpl::SystemConfigurationImpl() :
SystemConfigurationImpl::~SystemConfigurationImpl()
{
if(_envParam.name) delete[] _envParam.name;
}
bool SystemConfigurationImpl::getPropertyAsBoolean(const string &name, const bool defaultValue)
@@ -332,8 +329,7 @@ float SystemConfigurationImpl::getPropertyAsDouble(const string &name, const dou
string SystemConfigurationImpl::getPropertyAsString(const string &name, const string &defaultValue)
{
strncpy(_envParam.name,name.c_str(),name.length() + 1);
const char* val = envGetConfigParamPtr(&_envParam);
const char* val = getenv(name.c_str());
if(val != NULL)
{
return _properties->getProperty(name, string(val));
@@ -343,8 +339,7 @@ string SystemConfigurationImpl::getPropertyAsString(const string &name, const st
bool SystemConfigurationImpl::hasProperty(const string &key)
{
strncpy(_envParam.name,key.c_str(),key.length() + 1);
const char* val = envGetConfigParamPtr(&_envParam);
const char* val = getenv(key.c_str());
return (val != NULL) || _properties->hasProperty(key);
}

View File

@@ -152,7 +152,6 @@ public:
bool hasProperty(const std::string &name);
std::auto_ptr<Properties> _properties;
private:
ENV_PARAM _envParam;
std::istringstream _ibuffer;
std::ostringstream _obuffer;