ircd:Ⓜ️ Assertions for non-empty id constructions.

This commit is contained in:
Jason Volk 2023-04-29 20:35:43 -07:00
parent f6b3b8b758
commit 3c9a4f8c57
2 changed files with 20 additions and 8 deletions

View File

@ -187,9 +187,11 @@ struct ircd::m::room
const vm::copts *const &copts,
const event::fetch::opts *const &fopts = nullptr) noexcept;
room(const id &room_id = {},
room(const id &room_id,
const event::fetch::opts *const &fopts = nullptr) noexcept;
room() = default;
// Index of create event
static event::idx index(const id &, std::nothrow_t);
static event::idx index(const id &);
@ -229,7 +231,9 @@ ircd::m::room::room(const id &room_id,
,event_id{event_id? event::id{event_id} : event::id{}}
,copts{copts}
,fopts{fopts}
{}
{
assert(room_id);
}
inline
ircd::m::room::room(const id &room_id,
@ -239,7 +243,9 @@ noexcept
:room_id{room_id}
,copts{copts}
,fopts{fopts}
{}
{
assert(room_id);
}
inline
ircd::m::room::room(const id &room_id,
@ -247,7 +253,9 @@ ircd::m::room::room(const id &room_id,
noexcept
:room_id{room_id}
,fopts{fopts}
{}
{
assert(room_id);
}
inline ircd::m::room::operator
const ircd::m::room::id &()

View File

@ -74,13 +74,17 @@ struct ircd::m::user
event::id::buf deoper();
event::id::buf oper();
user(const id &user_id)
:user_id{user_id}
{}
user(const id &user_id);
user() = default;
};
inline
ircd::m::user::user(const id &user_id)
:user_id{user_id}
{
assert(user_id);
}
inline ircd::m::user::operator
const ircd::m::user::id &()
const