X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fextra%2Fm_regex_stdlib.cpp;h=b9602fe01d8f40ca15cd7a4f09076ed7d101a6b7;hb=bde0e7e84668df48afaffda7a52eddc0aca543d3;hp=42e5c8bf12106ec09984e4582e39d2a339ef2138;hpb=c6e40d36b42a7ebf832c3a57d2816a47ee9c9a76;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/extra/m_regex_stdlib.cpp b/src/modules/extra/m_regex_stdlib.cpp index 42e5c8bf1..b9602fe01 100644 --- a/src/modules/extra/m_regex_stdlib.cpp +++ b/src/modules/extra/m_regex_stdlib.cpp @@ -1,7 +1,10 @@ /* * InspIRCd -- Internet Relay Chat Daemon * - * Copyright (C) 2012 ChrisTX + * Copyright (C) 2019 Robby + * Copyright (C) 2013, 2016, 2018, 2020 Sadie Powell + * Copyright (C) 2013 Attila Molnar + * Copyright (C) 2012 ChrisTX * * This file is part of InspIRCd. InspIRCd is free software: you can * redistribute it and/or modify it under the terms of the GNU General Public @@ -30,10 +33,11 @@ class StdRegex : public Regex public: StdRegex(const std::string& rx, std::regex::flag_type fltype) : Regex(rx) { - try{ + try + { regexcl.assign(rx, fltype | std::regex::optimize); } - catch(std::regex_error rxerr) + catch(const std::regex_error& rxerr) { throw RegexException(rx, rxerr.what()); } @@ -66,14 +70,14 @@ public: Version GetVersion() CXX11_OVERRIDE { - return Version("Regex Provider Module for std::regex", VF_VENDOR); + return Version("Provides a regular expression engine which uses the C++11 std::regex regular expression matching system.", VF_VENDOR); } void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE { ConfigTag* Conf = ServerInstance->Config->ConfValue("stdregex"); - std::string regextype = Conf->getString("type", "ecmascript"); + const std::string regextype = Conf->getString("type", "ecmascript", 1); if (stdalgo::string::equalsci(regextype, "bre")) ref.regextype = std::regex::basic; else if (stdalgo::string::equalsci(regextype, "ere")) @@ -87,7 +91,7 @@ public: else { if (!stdalgo::string::equalsci(regextype, "ecmascript")) - ServerInstance->SNO->WriteToSnoMask('a', "WARNING: Non-existent regex engine '%s' specified. Falling back to ECMAScript.", regextype.c_str()); + ServerInstance->SNO->WriteToSnoMask('a', "WARNING: Nonexistent regex engine '%s' specified. Falling back to ECMAScript.", regextype.c_str()); ref.regextype = std::regex::ECMAScript; } }