ircd:Ⓜ️:room::missing: Move event::fetch out of loop body.
This commit is contained in:
parent
5856c2fd0e
commit
5141982828
|
@ -28,7 +28,7 @@ struct ircd::m::room::missing
|
||||||
m::room room;
|
m::room room;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool _each(m::room::events &, const closure &) const;
|
bool _each(m::room::events &, m::event::fetch &, const closure &) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool rfor_each(const pair<int64_t> &depth, const closure &) const;
|
bool rfor_each(const pair<int64_t> &depth, const closure &) const;
|
||||||
|
|
|
@ -40,12 +40,13 @@ const
|
||||||
room, uint64_t(depth.first)
|
room, uint64_t(depth.first)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
m::event::fetch event;
|
||||||
for(; it; ++it)
|
for(; it; ++it)
|
||||||
{
|
{
|
||||||
if(depth.second && int64_t(it.depth()) > depth.second)
|
if(depth.second && int64_t(it.depth()) > depth.second)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if(!_each(it, closure))
|
if(!_each(it, event, closure))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,6 +63,7 @@ const
|
||||||
room, depth.second?: -1UL
|
room, depth.second?: -1UL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
m::event::fetch event;
|
||||||
for(; it; --it)
|
for(; it; --it)
|
||||||
{
|
{
|
||||||
if(depth.second && int64_t(it.depth()) > depth.second)
|
if(depth.second && int64_t(it.depth()) > depth.second)
|
||||||
|
@ -70,7 +72,7 @@ const
|
||||||
if(int64_t(it.depth()) < depth.first)
|
if(int64_t(it.depth()) < depth.first)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if(!_each(it, closure))
|
if(!_each(it, event, closure))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,6 +81,7 @@ const
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ircd::m::room::missing::_each(m::room::events &it,
|
ircd::m::room::missing::_each(m::room::events &it,
|
||||||
|
m::event::fetch &event,
|
||||||
const closure &closure)
|
const closure &closure)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
|
@ -87,10 +90,8 @@ const
|
||||||
*it
|
*it
|
||||||
};
|
};
|
||||||
|
|
||||||
const m::event::fetch event
|
if(!seek(std::nothrow, event, event_idx))
|
||||||
{
|
return true;
|
||||||
std::nothrow, event_idx
|
|
||||||
};
|
|
||||||
|
|
||||||
const event::prev prev
|
const event::prev prev
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue