diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-04-07 13:22:17 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-04-07 13:22:17 +0000 |
commit | 6ec52cab73c5e77337ddd364617d8c4ad4065d80 (patch) | |
tree | 91ada68c6f7780a202133a4402b7e013af33e679 /src/modules.cpp | |
parent | 3717c045aabf40d8280d1f8a7a0f33383ecafae4 (diff) |
Fixed config reader to cache its files instead of re-reading them for each access
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@413 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules.cpp')
-rw-r--r-- | src/modules.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/modules.cpp b/src/modules.cpp index c1a912eca..b2424639a 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -295,7 +295,8 @@ bool Server::AddExtendedMode(char modechar, int type, bool requires_oper, int pa ConfigReader::ConfigReader() { - fname = CONFIG_FILE; + this->cache = new std::stringstream(stringstream::in | stringstream::out); + LoadConf(CONFIG_FILE,this->cache); } @@ -304,19 +305,23 @@ ConfigReader::~ConfigReader() } -ConfigReader::ConfigReader(std::string filename) : fname(filename) { }; +ConfigReader::ConfigReader(std::string filename) +{ + this->cache = new std::stringstream(stringstream::in | stringstream::out); + LoadConf(filename.c_str(),this->cache); +}; std::string ConfigReader::ReadValue(std::string tag, std::string name, int index) { char val[MAXBUF]; - ReadConf(fname.c_str(),tag.c_str(),name.c_str(),index,val); + ReadConf(cache,tag.c_str(),name.c_str(),index,val); return val; } int ConfigReader::Enumerate(std::string tag) { - return EnumConf(fname.c_str(),tag.c_str()); + return EnumConf(cache,tag.c_str()); } |