0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-17 15:30:52 +01:00

ircd:Ⓜ️:event::refs: Branch on the event_idx sentinel here.

This commit is contained in:
Jason Volk 2019-09-15 20:19:07 -07:00
parent 3f65055892
commit 568a2881df
2 changed files with 4 additions and 5 deletions

View file

@ -47,6 +47,4 @@ inline
ircd::m::event::refs::refs(const event::idx &idx) ircd::m::event::refs::refs(const event::idx &idx)
noexcept noexcept
:idx{idx} :idx{idx}
{ {}
assert(idx);
}

View file

@ -1895,7 +1895,6 @@ size_t
ircd::m::event::refs::count(const dbs::ref &type) ircd::m::event::refs::count(const dbs::ref &type)
const const
{ {
assert(idx);
size_t ret(0); size_t ret(0);
for_each(type, [&ret] for_each(type, [&ret]
(const event::idx &, const dbs::ref &) (const event::idx &, const dbs::ref &)
@ -1950,9 +1949,11 @@ ircd::m::event::refs::for_each(const dbs::ref &type,
const closure_bool &closure) const closure_bool &closure)
const const
{ {
assert(idx);
thread_local char buf[dbs::EVENT_REFS_KEY_MAX_SIZE]; thread_local char buf[dbs::EVENT_REFS_KEY_MAX_SIZE];
if(!idx)
return true;
// Allow -1 to iterate through all types by starting // Allow -1 to iterate through all types by starting
// the iteration at type value 0 and then ignoring the // the iteration at type value 0 and then ignoring the
// type as a loop continue condition. // type as a loop continue condition.