From: Remi Gacogne Date: Fri, 29 Jan 2021 15:56:03 +0000 (+0100) Subject: Pass strings as const references in exceptions X-Git-Tag: dnsdist-1.6.0-alpha1~1^2~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d78d76c3dd39e72d3849974b618946886f6862b0;p=thirdparty%2Fpdns.git Pass strings as const references in exceptions --- diff --git a/ext/luawrapper/include/LuaContext.hpp b/ext/luawrapper/include/LuaContext.hpp index 5017cd7b84..fa2ff91bf2 100644 --- a/ext/luawrapper/include/LuaContext.hpp +++ b/ext/luawrapper/include/LuaContext.hpp @@ -204,7 +204,7 @@ public: class WrongTypeException : public std::runtime_error { public: - WrongTypeException(std::string luaType_, const std::type_info& destination_) : + WrongTypeException(const std::string& luaType_, const std::type_info& destination_) : std::runtime_error("Trying to cast a lua variable from \"" + luaType_ + "\" to \"" + destination_.name() + "\""), luaType(luaType_), destination(destination_) diff --git a/pdns/pdnsexception.hh b/pdns/pdnsexception.hh index 67fce0adce..8960816b70 100644 --- a/pdns/pdnsexception.hh +++ b/pdns/pdnsexception.hh @@ -29,7 +29,7 @@ class PDNSException { public: PDNSException() : reason("Unspecified") {}; - PDNSException(string r) : reason(r) {}; + PDNSException(const string& r) : reason(r) {}; string reason; //! Print this to tell the user what went wrong }; @@ -38,5 +38,5 @@ class TimeoutException : public PDNSException { public: TimeoutException() : PDNSException() {} - TimeoutException(string r) : PDNSException(r) {} + TimeoutException(const string& r) : PDNSException(r) {} };