mirror of
https://github.com/matrix-construct/construct
synced 2025-01-16 17:46:54 +01:00
ircd::spirit: Assertions for output buffer state in generate template.
This commit is contained in:
parent
4823375701
commit
9dd9875611
1 changed files with 3 additions and 1 deletions
|
@ -319,7 +319,8 @@ ircd::spirit::generate(mutable_buffer &out,
|
||||||
|
|
||||||
if constexpr(truncation)
|
if constexpr(truncation)
|
||||||
{
|
{
|
||||||
begin(out) = state.overflow? end(out) : begin(out);
|
assert(begin(out) <= end(out));
|
||||||
|
begin(out) = state.overflow? end(out): begin(out);
|
||||||
assert(!state.overflow || begin(out) == end(out));
|
assert(!state.overflow || begin(out) == end(out));
|
||||||
assert(begin(out) <= end(out));
|
assert(begin(out) <= end(out));
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -334,6 +335,7 @@ ircd::spirit::generate(mutable_buffer &out,
|
||||||
std::distance(start, begin(out))
|
std::distance(start, begin(out))
|
||||||
};
|
};
|
||||||
|
|
||||||
|
assert(begin(out) <= end(out));
|
||||||
throw buffer_overrun
|
throw buffer_overrun
|
||||||
{
|
{
|
||||||
"Insufficient buffer of %s; required at least %s",
|
"Insufficient buffer of %s; required at least %s",
|
||||||
|
|
Loading…
Reference in a new issue