diff options
author | Adam <Adam@anope.org> | 2014-05-20 21:10:49 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2014-05-20 21:16:00 -0400 |
commit | 866f3f32ab3713e9867747f150df3698e456744e (patch) | |
tree | 20aabb18d88ee72a4fd412e17ebe30585496bd97 /include/config.h | |
parent | 20ce170024779aebbc1462146905c976836a552f (diff) |
Speed up akill xline checks
Cache xline nick, user, host, etc instead of rebuilding it everytime its
requested. Store users ip in sockaddr form and not string form to
prevent having to rebuild sockaddrs when checking xlines.
Also do not try to convert empty config values in Config::Get as this
can be rather common if a non string configuration value is not set, and
the cost of the ConvertException is great.
Diffstat (limited to 'include/config.h')
-rw-r--r-- | include/config.h | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/include/config.h b/include/config.h index 019564680..b132c5d2d 100644 --- a/include/config.h +++ b/include/config.h @@ -51,14 +51,13 @@ namespace Configuration template<typename T> T Get(const Anope::string &tag, const Anope::string &def) const { const Anope::string &value = this->Get<const Anope::string>(tag, def); - try - { - return convertTo<T>(value); - } - catch (const ConvertException &) - { - return T(); - } + if (!value.empty()) + try + { + return convertTo<T>(value); + } + catch (const ConvertException &) { } + return T(); } bool Set(const Anope::string &tag, const Anope::string &value); |