From 779fc767d975653825cff4a1cb5e68248a68989c Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Thu, 3 Dec 2020 01:18:17 -0800 Subject: [PATCH] ircd::m::id: Deinline ctor; construct string_view tight to valid mxid. --- include/ircd/m/id.h | 19 ++----------------- matrix/id.cc | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/include/ircd/m/id.h b/include/ircd/m/id.h index a431b8be0..695e00c6b 100644 --- a/include/ircd/m/id.h +++ b/include/ircd/m/id.h @@ -81,11 +81,11 @@ struct ircd::m::id IRCD_USING_OVERLOAD(generate, m::generate); + explicit id(const enum sigil &, const id &) noexcept; id(const enum sigil &, const mutable_buffer &, const generate_t &, const string_view &host); id(const enum sigil &, const mutable_buffer &, const string_view &local, const string_view &host); id(const enum sigil &, const mutable_buffer &, const string_view &id); id(const enum sigil &, const string_view &id); - explicit id(const enum sigil &, const id &); id(const string_view &id); id() = default; }; @@ -374,26 +374,11 @@ struct ircd::m::id::buf } }; -inline -ircd::m::id::id(const string_view &str) -:id -{ - m::sigil(str), str -} -{} - inline ircd::m::id::id(const id::sigil &sigil, const id &id) +noexcept :string_view{id} { assert(this->empty() || this->front() == sigil); } - -inline -ircd::m::id::id(const id::sigil &sigil, - const string_view &id) -:string_view{id} -{ - valid(sigil, id); -} diff --git a/matrix/id.cc b/matrix/id.cc index 2aa8a8faa..787a59da5 100644 --- a/matrix/id.cc +++ b/matrix/id.cc @@ -445,6 +445,23 @@ const // id::id // +ircd::m::id::id(const string_view &str) +:id +{ + m::sigil(str), str +} +{ +} + +ircd::m::id::id(const id::sigil &sigil, + const string_view &id) +:string_view +{ + parser(sigil, id) +} +{ +} + ircd::m::id::id(const enum sigil &sigil, const mutable_buffer &buf, const string_view &local,