0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-10-02 13:48:53 +02:00

ircd::json: Check stringify size on all builds; note valid assert issue.

This commit is contained in:
Jason Volk 2018-01-23 20:59:47 -08:00
parent a79af0e606
commit e4863aa073

View file

@ -185,7 +185,7 @@ ircd::json::print(char *const &buf,
};
assert(sv.size() < max);
assert(valid(sv, std::nothrow));
assert(valid(sv, std::nothrow)); //note: false alarm when T=json::member
buf[sv.size()] = '\0';
return sv.size();
}
@ -207,12 +207,12 @@ ircd::json::strung::strung(T&&... t)
print(buf, max, std::forward<T>(t)...)
};
#ifdef RB_DEBUG
if(unlikely(printed != ret.size()))
std::cerr << printed << " != " << ret.size() << std::endl << ret << std::endl;
#endif
throw assertive
{
"%zu != %zu: %s", printed, ret.size(), ret
};
assert(printed == ret.size());
return ret;
}()}
{