From 1befd6ea00733b59df861731e09de7779146bcda Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Thu, 30 Sep 2021 19:15:18 +0100 Subject: Move the ParseStack constructor out of the header. --- include/configparser.h | 33 +-------------------------------- src/configparser.cpp | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 32 deletions(-) diff --git a/include/configparser.h b/include/configparser.h index 0f6295e37..1a842df3c 100644 --- a/include/configparser.h +++ b/include/configparser.h @@ -30,38 +30,7 @@ struct ParseStack ConfigFileCache& FilesOutput; std::stringstream& errstr; - ParseStack(ServerConfig* conf) - : output(conf->config_data), FilesOutput(conf->Files), errstr(conf->errstr) - { - // Special character escapes. - vars["newline"] = "\n"; - vars["nl"] = "\n"; - - // XML escapes. - vars["amp"] = "&"; - vars["apos"] = "'"; - vars["gt"] = ">"; - vars["lt"] = "<"; - vars["quot"] = "\""; - - // Directories that were set at build time. - vars["dir.config"] = INSPIRCD_CONFIG_PATH; - vars["dir.data"] = INSPIRCD_DATA_PATH; - vars["dir.log"] = INSPIRCD_LOG_PATH; - vars["dir.module"] = INSPIRCD_MODULE_PATH; - vars["dir.runtime"] = INSPIRCD_RUNTIME_PATH; - - // IRC formatting codes. - vars["irc.bold"] = "\x02"; - vars["irc.color"] = "\x03"; - vars["irc.colour"] = "\x03"; - vars["irc.italic"] = "\x1D"; - vars["irc.monospace"] = "\x11"; - vars["irc.reset"] = "\x0F"; - vars["irc.reverse"] = "\x16"; - vars["irc.strikethrough"] = "\x1E"; - vars["irc.underline"] = "\x1F"; - } + ParseStack(ServerConfig* conf); bool ParseFile(const std::string& name, int flags, const std::string& mandatory_tag = std::string(), bool isexec = false); void DoInclude(ConfigTag* includeTag, int flags); void DoReadFile(const std::string& key, const std::string& file, int flags, bool exec); diff --git a/src/configparser.cpp b/src/configparser.cpp index ed0557db1..e05dcd6ff 100644 --- a/src/configparser.cpp +++ b/src/configparser.cpp @@ -504,6 +504,41 @@ void ParseStack::DoReadFile(const std::string& key, const std::string& name, int } } +ParseStack::ParseStack(ServerConfig* conf) + : output(conf->config_data) + , FilesOutput(conf->Files) + , errstr(conf->errstr) +{ + // Special character escapes. + vars["newline"] = "\n"; + vars["nl"] = "\n"; + + // XML escapes. + vars["amp"] = "&"; + vars["apos"] = "'"; + vars["gt"] = ">"; + vars["lt"] = "<"; + vars["quot"] = "\""; + + // Directories that were set at build time. + vars["dir.config"] = INSPIRCD_CONFIG_PATH; + vars["dir.data"] = INSPIRCD_DATA_PATH; + vars["dir.log"] = INSPIRCD_LOG_PATH; + vars["dir.module"] = INSPIRCD_MODULE_PATH; + vars["dir.runtime"] = INSPIRCD_RUNTIME_PATH; + + // IRC formatting codes. + vars["irc.bold"] = "\x02"; + vars["irc.color"] = "\x03"; + vars["irc.colour"] = "\x03"; + vars["irc.italic"] = "\x1D"; + vars["irc.monospace"] = "\x11"; + vars["irc.reset"] = "\x0F"; + vars["irc.reverse"] = "\x16"; + vars["irc.strikethrough"] = "\x1E"; + vars["irc.underline"] = "\x1F"; +} + bool ParseStack::ParseFile(const std::string& path, int flags, const std::string& mandatory_tag, bool isexec) { ServerInstance->Logs->Log("CONFIG", LOG_DEBUG, "Reading (isexec=%d) %s", isexec, path.c_str()); -- cgit v1.3.1-10-gc9f91