1
0
mirror of https://github.com/anope/anope.git synced 2026-06-12 17:04:47 +02:00

Config file parser in ServerConfig::LoadConf modified to allow for a single-directive single-line block.

This allows for a construct like: module { name = "load_me" }

git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1687 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
cyberbotx
2008-11-15 01:28:58 +00:00
parent 2d07704bb6
commit cc5bc5b363
2 changed files with 16 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
/autom4te.cache
Makefile
config.cache
config.log
config.status
+11 -2
View File
@@ -1050,8 +1050,17 @@ bool ServerConfig::LoadConf(ConfigDataHash &target, const char *filename, std::o
return false;
}
if (!wordbuffer.empty() || !itemname.empty()) {
errorstream << "Unexpected end of section: " << filename << ":" << linenumber << std::endl;
return false;
// this will allow for the construct: section { key = value }
// but will not allow for anything else, such as: section { key = value; key = value }
if (!sectiondata.empty()) {
errorstream << "Unexpected end of section: " << filename << ":" << linenumber << std::endl;
return false;
}
// this is the same as the below section for testing if itemname is non-empty after the loop, but done inside it to allow the above construct
if (debug) alog("ln %d EOL: s='%s' '%s' set to '%s'", linenumber, section.c_str(), itemname.c_str(), wordbuffer.c_str());
sectiondata.push_back(KeyVal(itemname, wordbuffer));
wordbuffer.clear();
itemname.clear();
}
target.insert(std::pair<std::string, KeyValList>(section, sectiondata));
section.clear();