0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-28 11:48:54 +02:00

ircd::json: Allow stack objects to have dtor called manually to close JSON.

This commit is contained in:
Jason Volk 2018-04-10 14:17:56 -07:00
parent 102ef2cb47
commit bc4cb5cf8c

View file

@ -578,6 +578,12 @@ noexcept
if(!s)
return; // std::move()'ed away
const unwind _{[this]
{
// Allows ~dtor to be called to close the JSON manually
s = nullptr;
}};
assert(cm == nullptr);
s->printer(json::printer.object_end);
@ -663,6 +669,12 @@ noexcept
if(!s)
return; // std::move()'ed away
const unwind _{[this]
{
// Allows ~dtor to be called to close the JSON manually
s = nullptr;
}};
assert(co == nullptr);
assert(ca == nullptr);
s->printer(json::printer.array_end);
@ -766,6 +778,12 @@ noexcept
if(!s)
return; // std::move()'ed away
const unwind _{[this]
{
// Allows ~dtor to be called to close the JSON manually
s = nullptr;
}};
assert(co == nullptr);
assert(ca == nullptr);
assert(po);