diff options
author | cyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-10-13 01:17:30 +0000 |
---|---|---|
committer | cyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-10-13 01:17:30 +0000 |
commit | 0d88137738faca951564e5786b209d9d54c10ee2 (patch) | |
tree | 28e138da193f6c62c602829967c0d917f2a1a355 /src/configreader.cpp | |
parent | 5bcb780c6d486b603856016dc566b3a403548545 (diff) |
Code style cleanup, replace static_cast<std::string>() with std::string(), slight updates to config reader from InspIRCd.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2555 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/configreader.cpp')
-rw-r--r-- | src/configreader.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/configreader.cpp b/src/configreader.cpp index 62e30efda..cb02e6002 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -21,7 +21,7 @@ ConfigReader::~ConfigReader() { if (this->errorlog) delete this->errorlog; - if(this->privatehash) + if (this->privatehash) delete this->data; } @@ -34,7 +34,10 @@ std::string ConfigReader::ReadValue(const std::string &tag, const std::string &n { /* Don't need to strlcpy() tag and name anymore, ReadConf() takes const char* */ std::string result; - if (!serverConfig.ConfValue(*this->data, tag, name, default_value, index, result, allow_linefeeds)) this->error = CONF_VALUE_NOT_FOUND; + + if (!serverConfig.ConfValue(*this->data, tag, name, default_value, index, result, allow_linefeeds)) + this->error = CONF_VALUE_NOT_FOUND; + return result; } @@ -56,14 +59,19 @@ bool ConfigReader::ReadFlag(const std::string &tag, const std::string &name, int int ConfigReader::ReadInteger(const std::string &tag, const std::string &name, const std::string &default_value, int index, bool need_positive) { int result; - if (!serverConfig.ConfValueInteger(*this->data, tag, name, default_value, index, result)) { + + if (!serverConfig.ConfValueInteger(*this->data, tag, name, default_value, index, result)) + { this->error = CONF_VALUE_NOT_FOUND; return 0; } - if (need_positive && result < 0) { + + if (need_positive && result < 0) + { this->error = CONF_INT_NEGATIVE; return 0; } + return result; } |