From b7293380376580af4480c38f0b5a35b4b7687cb1 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Mon, 16 Apr 2018 15:58:26 -0700 Subject: [PATCH] ircd::m::room: Move event::fetch outside loop to prevent constructions. --- ircd/m/room.cc | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/ircd/m/room.cc b/ircd/m/room.cc index c4fd1496d..80f7d00e3 100644 --- a/ircd/m/room.cc +++ b/ircd/m/room.cc @@ -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);