0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2025-01-14 00:34:18 +01:00

ircd::json::stack: Move final-flush to stack dtor rather than top value dtor.

This commit is contained in:
Jason Volk 2019-02-24 13:48:44 -08:00
parent ec50b0f76e
commit ea4912d09a

View file

@ -447,6 +447,10 @@ noexcept
ircd::json::stack::~stack() ircd::json::stack::~stack()
noexcept noexcept
{ {
assert(closed());
if(buf.consumed())
flush(true);
assert(clean() || done()); assert(clean() || done());
} }
@ -688,7 +692,7 @@ ircd::json::stack::object::object(stack &s)
} }
ircd::json::stack::object::object(stack &s, ircd::json::stack::object::object(stack &s,
const string_view &name) const string_view &name)
:object{object::top(s), name} :object{object::top(s), name}
{ {
} }
@ -784,13 +788,12 @@ noexcept
return; return;
} }
// branch taken if top of stack:: (w/ final flush) // branch taken if top of stack::
assert(s->co == this); assert(s->co == this);
assert(s->ca == nullptr); assert(s->ca == nullptr);
assert(pm == nullptr && pa == nullptr); assert(pm == nullptr && pa == nullptr);
s->co = nullptr; s->co = nullptr;
assert(s->done()); assert(s->closed());
s->flush(true);
} }
// //
@ -958,13 +961,12 @@ noexcept
return; return;
} }
// branch taken if top of stack:: (w/ final flush) // branch taken if top of stack::
assert(s->ca == this); assert(s->ca == this);
assert(s->co == nullptr); assert(s->co == nullptr);
assert(pm == nullptr && pa == nullptr); assert(pm == nullptr && pa == nullptr);
s->ca = nullptr; s->ca = nullptr;
assert(s->done()); assert(s->closed());
s->flush(true);
} }
void void