From 30684661752b83348a65dddc9606325c542d03fc Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Wed, 20 Jul 2022 16:15:17 -0700 Subject: [PATCH] ircd::versions: Declare list specialization; noexcept ctors; minor cleanup. --- include/ircd/versions.h | 15 +++++++++++++-- ircd/versions.cc | 8 +++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/include/ircd/versions.h b/include/ircd/versions.h index 4ed8c4d57..b69fbe67e 100644 --- a/include/ircd/versions.h +++ b/include/ircd/versions.h @@ -59,13 +59,13 @@ struct ircd::versions const enum type &type = type::API, const long &monotonic = 0, const std::array &semantic = {0L}, - const string_view &string = {}); + const string_view &string = {}) noexcept; versions(const string_view &name, const enum type &type, const long &monotonic, const std::array &semantic, - const std::function &generator); + const std::function &generator) noexcept; versions() = default; versions(versions &&) = delete; @@ -73,6 +73,17 @@ struct ircd::versions ~versions() noexcept; }; +namespace ircd +{ + template<> + decltype(versions::allocator) + instance_list::allocator; + + template<> + decltype(versions::list) + instance_list::list; +} + inline ircd::versions::operator const long &() const diff --git a/ircd/versions.cc b/ircd/versions.cc index 72aa571a2..16c71a5ca 100644 --- a/ircd/versions.cc +++ b/ircd/versions.cc @@ -21,7 +21,7 @@ template<> decltype(ircd::util::instance_list::list) ircd::util::instance_list::list { - allocator + allocator }; /// Straightforward construction of versions members; string is copied @@ -31,10 +31,11 @@ ircd::versions::versions(const string_view &name, const long &monotonic, const std::array &semantic, const string_view &string) +noexcept :versions { name, type, monotonic, semantic, [&string] - (auto &that, const mutable_buffer &buf) + (auto &that, const mutable_buffer &buf) noexcept { strlcpy(buf, string); } @@ -49,6 +50,7 @@ ircd::versions::versions(const string_view &name, const long &monotonic, const std::array &semantic, const std::function &closure) +noexcept :name{name} ,type{type} ,monotonic{monotonic} @@ -61,7 +63,7 @@ ircd::versions::versions(const string_view &name, } catch(const std::exception &e) { - log::error + log::critical { "Querying %s version of '%s' :%s", type == type::ABI? "ABI"_sv : "API"_sv,