mirror of
https://github.com/matrix-construct/construct
synced 2024-11-16 23:10:54 +01:00
ircd::buffer: Hoist null_buffer to inline variable; move buffers typedefs.
This commit is contained in:
parent
d68f261036
commit
81b6c7b003
3 changed files with 23 additions and 18 deletions
|
@ -46,17 +46,14 @@ namespace ircd::buffer
|
||||||
|
|
||||||
template<size_t SIZE> using fixed_const_buffer = fixed_buffer<const_buffer, SIZE>;
|
template<size_t SIZE> using fixed_const_buffer = fixed_buffer<const_buffer, SIZE>;
|
||||||
template<size_t SIZE> using fixed_mutable_buffer = fixed_buffer<mutable_buffer, SIZE>;
|
template<size_t SIZE> using fixed_mutable_buffer = fixed_buffer<mutable_buffer, SIZE>;
|
||||||
template<template<class> class I> using const_buffers = I<const_buffer>;
|
|
||||||
template<template<class> class I> using mutable_buffers = I<mutable_buffer>;
|
|
||||||
|
|
||||||
using unique_const_buffer = unique_buffer<const_buffer>;
|
using unique_const_buffer = unique_buffer<const_buffer>;
|
||||||
using unique_mutable_buffer = unique_buffer<mutable_buffer>;
|
using unique_mutable_buffer = unique_buffer<mutable_buffer>;
|
||||||
using shared_const_buffer = shared_buffer<const_buffer>;
|
using shared_const_buffer = shared_buffer<const_buffer>;
|
||||||
using shared_mutable_buffer = shared_buffer<mutable_buffer>;
|
using shared_mutable_buffer = shared_buffer<mutable_buffer>;
|
||||||
|
|
||||||
// Preconstructed null buffers
|
// Convenience null buffer
|
||||||
extern const mutable_buffer null_buffer;
|
extern const mutable_buffer null_buffer;
|
||||||
extern const ilist<mutable_buffer> null_buffers;
|
|
||||||
|
|
||||||
// Single buffer iteration of contents
|
// Single buffer iteration of contents
|
||||||
template<class it> const it &begin(const buffer<it> &buffer);
|
template<class it> const it &begin(const buffer<it> &buffer);
|
||||||
|
@ -121,9 +118,11 @@ namespace ircd
|
||||||
using buffer::unique_mutable_buffer;
|
using buffer::unique_mutable_buffer;
|
||||||
using buffer::shared_const_buffer;
|
using buffer::shared_const_buffer;
|
||||||
using buffer::shared_mutable_buffer;
|
using buffer::shared_mutable_buffer;
|
||||||
|
using buffer::null_buffer;
|
||||||
|
|
||||||
using buffer::const_buffers;
|
using buffers::const_buffers;
|
||||||
using buffer::mutable_buffers;
|
using buffers::mutable_buffers;
|
||||||
|
using buffers::null_buffers;
|
||||||
|
|
||||||
using buffer::size;
|
using buffer::size;
|
||||||
using buffer::data;
|
using buffer::data;
|
||||||
|
@ -351,3 +350,15 @@ ircd::buffer::begin(const buffer<it> &buffer)
|
||||||
{
|
{
|
||||||
return get<0>(buffer);
|
return get<0>(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline decltype(ircd::buffer::null_buffer)
|
||||||
|
ircd::buffer::null_buffer
|
||||||
|
{
|
||||||
|
nullptr, nullptr
|
||||||
|
};
|
||||||
|
|
||||||
|
inline decltype(ircd::buffers::null_buffers)
|
||||||
|
ircd::buffers::null_buffers
|
||||||
|
{
|
||||||
|
{ null_buffer }
|
||||||
|
};
|
||||||
|
|
|
@ -13,6 +13,12 @@
|
||||||
|
|
||||||
namespace ircd::buffer::buffers
|
namespace ircd::buffer::buffers
|
||||||
{
|
{
|
||||||
|
template<template<class> class I> using const_buffers = I<const_buffer>;
|
||||||
|
template<template<class> class I> using mutable_buffers = I<mutable_buffer>;
|
||||||
|
|
||||||
|
// Convenience null buffers
|
||||||
|
extern const ilist<mutable_buffer> null_buffers;
|
||||||
|
|
||||||
// Iterable of buffers tools
|
// Iterable of buffers tools
|
||||||
template<template<class> class I, class T> size_t size(const I<T> &buffers);
|
template<template<class> class I, class T> size_t size(const I<T> &buffers);
|
||||||
template<template<class> class I, class T> size_t copy(const mutable_buffer &, const I<T> &buffer);
|
template<template<class> class I, class T> size_t copy(const mutable_buffer &, const I<T> &buffer);
|
||||||
|
|
12
ircd/net.cc
12
ircd/net.cc
|
@ -3204,18 +3204,6 @@ ircd::net::string(const mutable_buffer &out,
|
||||||
// buffer.h - provide definition for the null buffers and asio conversion
|
// buffer.h - provide definition for the null buffers and asio conversion
|
||||||
//
|
//
|
||||||
|
|
||||||
const ircd::buffer::mutable_buffer
|
|
||||||
ircd::buffer::null_buffer
|
|
||||||
{
|
|
||||||
nullptr, nullptr
|
|
||||||
};
|
|
||||||
|
|
||||||
const ircd::ilist<ircd::buffer::mutable_buffer>
|
|
||||||
ircd::buffer::null_buffers
|
|
||||||
{{
|
|
||||||
null_buffer
|
|
||||||
}};
|
|
||||||
|
|
||||||
[[gnu::visibility("protected")]]
|
[[gnu::visibility("protected")]]
|
||||||
ircd::buffer::mutable_buffer::operator
|
ircd::buffer::mutable_buffer::operator
|
||||||
boost::asio::mutable_buffer()
|
boost::asio::mutable_buffer()
|
||||||
|
|
Loading…
Reference in a new issue