0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-17 15:30:52 +01:00

ircd::json: Cleanup generator definition here; use better rule template.

This commit is contained in:
Jason Volk 2019-02-08 19:33:55 -08:00
parent 3151931ee4
commit 77bbdd9ebe

View file

@ -41,7 +41,7 @@ struct ircd::json::input
:qi::grammar<const char *, unused_type>
{
using it = const char *;
template<class T = unused_type> using rule = qi::rule<it, T>;
template<class T = unused_type, class... A> using rule = qi::rule<it, T, A...>;
rule<> NUL { lit('\0') ,"nul" };
@ -174,7 +174,7 @@ struct ircd::json::output
:karma::grammar<char *, unused_type>
{
using it = char *;
template<class T = unused_type> using rule = karma::rule<it, T>;
template<class T = unused_type, class... A> using rule = karma::rule<it, T, A...>;
rule<> NUL { lit('\0') ,"nul" };
@ -1073,8 +1073,13 @@ ircd::json::stack::member::member(object &po,
s->append(","_sv);
thread_local char tmp[2048];
static const json::printer::rule<string_view> rule
{
json::printer.name << json::printer.name_sep
};
mutable_buffer buf{tmp};
if(!printer(buf, json::printer.name << json::printer.name_sep, name))
if(!printer(buf, rule, name))
throw error
{
"member name overflow: max size is under %zu", sizeof(tmp)