0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-02 18:18:56 +02:00

ircd::json: Improve return count; add condition for noisy dwarning.

This commit is contained in:
Jason Volk 2020-09-18 22:08:39 -07:00
parent 6edb1d4eec
commit 305aa691e7

View file

@ -1077,14 +1077,15 @@ noexcept try
invalidate_checkpoints()
};
log::dwarning
{
"Flushing json::stack(%p) bytes:%zu level:%zu checkpoints:%zu",
this,
size(buf.completed()),
level,
invalidated,
};
if(invalidated)
log::dwarning
{
"Flushing json::stack(%p) bytes:%zu level:%zu checkpoints:%zu",
this,
size(buf.completed()),
level,
invalidated,
};
}
// The user returns the portion of the buffer they were able to flush
@ -1111,8 +1112,11 @@ size_t
ircd::json::stack::invalidate_checkpoints()
{
size_t ret(0);
for(auto cp(this->cp); cp; cp = cp->pc, ++ret)
for(auto cp(this->cp); cp; cp = cp->pc)
{
ret += cp->s != nullptr;
cp->s = nullptr;
}
this->cp = nullptr;
return ret;