mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 15:33:54 +01:00
ircd::ctx::list: Reduce out-of-line accessor surface.
This commit is contained in:
parent
a3dc7331cc
commit
52013c1ee0
2 changed files with 41 additions and 24 deletions
|
@ -40,6 +40,9 @@ struct ircd::ctx::list
|
|||
ctx *head {nullptr};
|
||||
ctx *tail {nullptr};
|
||||
|
||||
[[gnu::leaf]] static const node &get(const ctx &) noexcept;
|
||||
[[gnu::leaf]] static node &get(ctx &) noexcept;
|
||||
|
||||
// Get next or prev entry in ctx
|
||||
static const ctx *next(const ctx *const &) noexcept;
|
||||
static const ctx *prev(const ctx *const &) noexcept;
|
||||
|
@ -170,3 +173,35 @@ const noexcept
|
|||
{
|
||||
return head;
|
||||
}
|
||||
|
||||
inline ircd::ctx::ctx *&
|
||||
ircd::ctx::list::prev(ctx *const &c)
|
||||
noexcept
|
||||
{
|
||||
assert(c);
|
||||
return get(*c).prev;
|
||||
}
|
||||
|
||||
inline ircd::ctx::ctx *&
|
||||
ircd::ctx::list::next(ctx *const &c)
|
||||
noexcept
|
||||
{
|
||||
assert(c);
|
||||
return get(*c).next;
|
||||
}
|
||||
|
||||
inline const ircd::ctx::ctx *
|
||||
ircd::ctx::list::prev(const ctx *const &c)
|
||||
noexcept
|
||||
{
|
||||
assert(c);
|
||||
return get(*c).prev;
|
||||
}
|
||||
|
||||
inline const ircd::ctx::ctx *
|
||||
ircd::ctx::list::next(const ctx *const &c)
|
||||
noexcept
|
||||
{
|
||||
assert(c);
|
||||
return get(*c).next;
|
||||
}
|
||||
|
|
30
ircd/ctx.cc
30
ircd/ctx.cc
|
@ -3041,36 +3041,18 @@ const
|
|||
return true;
|
||||
}
|
||||
|
||||
ircd::ctx::ctx *&
|
||||
ircd::ctx::list::prev(ctx *const &c)
|
||||
ircd::ctx::list::node &
|
||||
ircd::ctx::list::get(ctx &c)
|
||||
noexcept
|
||||
{
|
||||
assert(c);
|
||||
return c->node.prev;
|
||||
return c.node;
|
||||
}
|
||||
|
||||
ircd::ctx::ctx *&
|
||||
ircd::ctx::list::next(ctx *const &c)
|
||||
const ircd::ctx::list::node &
|
||||
ircd::ctx::list::get(const ctx &c)
|
||||
noexcept
|
||||
{
|
||||
assert(c);
|
||||
return c->node.next;
|
||||
}
|
||||
|
||||
const ircd::ctx::ctx *
|
||||
ircd::ctx::list::prev(const ctx *const &c)
|
||||
noexcept
|
||||
{
|
||||
assert(c);
|
||||
return c->node.prev;
|
||||
}
|
||||
|
||||
const ircd::ctx::ctx *
|
||||
ircd::ctx::list::next(const ctx *const &c)
|
||||
noexcept
|
||||
{
|
||||
assert(c);
|
||||
return c->node.next;
|
||||
return c.node;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Reference in a new issue