X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fconfigparser.cpp;h=3be1ac9c53d39ce44f0a79dcd6d81defa55735f9;hb=0612de153ff8a731992fee0d1812295cd98c6e8d;hp=1c406f218f793079875b625f2b841c255ad6d069;hpb=3a3ff949670c61a4a8856e1391222e156eb1cd17;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/configparser.cpp b/src/configparser.cpp index 1c406f218..3be1ac9c5 100644 --- a/src/configparser.cpp +++ b/src/configparser.cpp @@ -155,7 +155,7 @@ struct Parser } else { - std::map::iterator var = stack.vars.find(varname); + insp::flat_map::iterator var = stack.vars.find(varname); if (var == stack.vars.end()) throw CoreException("Undefined XML entity reference '&" + varname + ";'"); value.append(var->second); @@ -367,7 +367,7 @@ void ParseStack::DoReadFile(const std::string& key, const std::string& name, int 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()); - if (std::find(reading.begin(), reading.end(), path) != reading.end()) + if (stdalgo::isin(reading, path)) throw CoreException((isexec ? "Executable " : "File ") + path + " is included recursively (looped inclusion)"); /* It's not already included, add it to the list of files we've loaded */ @@ -385,17 +385,6 @@ bool ParseStack::ParseFile(const std::string& path, int flags, const std::string bool ConfigTag::readString(const std::string& key, std::string& value, bool allow_lf) { -#ifdef __clang__ -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wunknown-pragmas" -# pragma clang diagnostic ignored "-Wundefined-bool-conversion" -#endif - // TODO: this is undefined behaviour but changing the API is too risky for 2.0. - if (!this) - return false; -#ifdef __clang__ -# pragma clang diagnostic pop -#endif for(std::vector::iterator j = items.begin(); j != items.end(); ++j) { if(j->first != key)