0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-28 00:14:07 +01:00

ircd:Ⓜ️:room: Move event::fetch outside loop to prevent constructions.

This commit is contained in:
Jason Volk 2018-04-16 15:58:26 -07:00
parent d5cd5dea09
commit b729338037

View file

@ -219,15 +219,11 @@ void
ircd::m::room::for_each(const event::closure_bool &closure)
const
{
for_each(event::id::closure_bool{[&closure]
event::fetch event;
for_each(event::id::closure_bool{[&closure, &event]
(const event::id &event_id)
{
const event::fetch event
{
event_id, std::nothrow
};
if(!event.valid(event_id))
if(!seek(event, event_id, std::nothrow))
return true;
return closure(event);
@ -284,15 +280,11 @@ ircd::m::room::for_each(const string_view &type,
const event::closure_bool &closure)
const
{
for_each(type, event::id::closure_bool{[&closure]
event::fetch event;
for_each(type, event::id::closure_bool{[&closure, &event]
(const event::id &event_id)
{
const event::fetch event
{
event_id, std::nothrow
};
if(!event.valid(event_id))
if(!seek(event, event_id, std::nothrow))
return true;
return closure(event);