0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-27 07:54:05 +01:00

ircd::buffer: lte range assertion on ctor; remove attr; minor reorg.

ircd::buffer::window_buffer: Assertion on consumption increments.
This commit is contained in:
Jason Volk 2020-06-04 20:26:26 -07:00
parent 619ecb4b5b
commit 04020a91b7
2 changed files with 13 additions and 9 deletions

View file

@ -55,13 +55,6 @@ ircd::buffer::buffer<it>::buffer(const it &start,
:buffer{start, start + size} :buffer{start, start + size}
{} {}
template<class it>
inline __attribute__((always_inline, flatten))
ircd::buffer::buffer<it>::buffer(const it &start,
const it &stop)
:std::pair<it, it>{start, stop}
{}
template<class it> template<class it>
inline __attribute__((always_inline)) inline __attribute__((always_inline))
ircd::buffer::buffer<it>::buffer(const buffer &start, ircd::buffer::buffer<it>::buffer(const buffer &start,
@ -73,7 +66,16 @@ ircd::buffer::buffer<it>::buffer(const buffer &start,
{} {}
template<class it> template<class it>
inline __attribute__((always_inline, flatten)) inline __attribute__((always_inline))
ircd::buffer::buffer<it>::buffer(const it &start,
const it &stop)
:std::pair<it, it>{start, stop}
{
//assert(this->begin() <= this->end());
}
template<class it>
inline __attribute__((always_inline))
ircd::buffer::buffer<it>::operator string_view() ircd::buffer::buffer<it>::operator string_view()
const const
{ {

View file

@ -102,7 +102,9 @@ ircd::buffer::window_buffer::operator()(const closure_cbuf &closure)
inline ircd::buffer::const_buffer inline ircd::buffer::const_buffer
ircd::buffer::window_buffer::operator()(const closure &closure) ircd::buffer::window_buffer::operator()(const closure &closure)
{ {
consume(*this, closure(*this)); const size_t addl(closure(*this));
assert(addl <= remaining());
consume(*this, addl);
return completed(); return completed();
} }