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:
parent
3151931ee4
commit
77bbdd9ebe
1 changed files with 8 additions and 3 deletions
11
ircd/json.cc
11
ircd/json.cc
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue