0
0
Fork 0
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:
Jason Volk 2020-07-11 18:21:38 -07:00
parent a3dc7331cc
commit 52013c1ee0
2 changed files with 41 additions and 24 deletions

View file

@ -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;
}

View file

@ -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;
}
///////////////////////////////////////////////////////////////////////////////